题记
再次看看solr的官方指导手册,发现了一些之前没看到的内容,现在简单的记录一下.
2015年05月08日17:41:38 看到P35
页
一.总体方法
下面是应用服务集成solr的方法:
Solr makes it easy to add the capability to search through the online store
through the following steps:
1.Define a schema . The schema tells Solr about the contents of documents it will be indexing.
Solr's schema is powerful and flexible and allows you to tailor Solr's behavior to your application.
定义schema(schema不知怎么翻译,可以理解为一个数据的集合).告诉solr将要检索的文档内容.
2. Deploy Solr to your application server.
部署solr到应用服务器,也就是继承solr服务.
3. Feed Solr the document for which your users will search.
可以理解为上传要搜索的文档,这里的内容可以是数据库(DIH)或富文本(PDF,PPT).富文本需要变更句柄
/update/extract
4. Expose search functionality in your application.
这时就可以进行搜索,将搜索的结果结合页面展示.
二.Documents, Fields, and Schema Design
这个部分可以设置搜索结果的内容.
三.analyzer,token,filter
这里可以通过设置决定solr搜索的分析器以及过滤器;也可以添加自己的分析器,一般处理中文时候,可添加中文分词器.
analyzer 分析器
+ token
The job of a tokenizer is to break up a stream of text into tokens,
where each token is (usually) a sub-sequence of the characters in the text.
- 将内容切分成令牌流
+filter
a filter's input is another TokenStream. The job of a filter is usually easier than that of a tokenizer since in
most cases a filter looks at each token in the stream sequentially and decides whether to pass it along, replace it or discard it.
决定令牌流内容是否可用,被替换或遗弃.
待续