Apache Nutch 1.6 发布
Apache Nutch 1.6 发布,该版本修复了超过 20 个 bug,新功能包括:新的 HostNormalizer,可通过 MIME-type 和 Indexer API 的功能增强来动态设置 fetchInterval ,更新 Tika 到 1.2 版本,更新 Autimaton 到 1.11-8 版本。
Solr In action 试读本
《solr in action》这个可能是第一本关于 Solr 4.0 的书籍,看样子是还没写完,这里有第一章的文件,有兴趣的同学可以点击下载:Solr_meap_ch01
文件大小:1.44M
格式:PDF
页数:26页
带 IK 分词器的 Luke
Solr 缓存配置(一)
缓存在 Solr 中充当了一个非常重要的角色,Solr 中主要有这三种缓存:
- Filter cache(过滤器缓存),用于保存过滤器(fq 参数)和层面搜索的结果
- Document cache(文档缓存),用于保存 lucene 文档存储的字段
- Query result(查询缓存),用于保存查询的结果
- 索引中文档的数量
- 每秒钟搜索的次数
- 过滤器的数量
- 一次查询返回最大的文档数量
- 不同查询和不同排序的个数
- 索引中文档的数量:1000000
- 每秒钟搜索的次数:100
- 过滤器的数量:200
- 一次查询返回最大的文档数量:100
- 不同查询和不同排序的个数:500
1
|
<
filterCache
class
=
"solr.FastLRUCache"
size
=
"200"
initialSize
=
"200"
autowarmCount
=
"100"
/>
|
第二个是查询结果缓存:
1
|
<
queryResultCache
class
=
"solr.FastLRUCache"
size
=
"500"
initialSize
=
"500"
autowarmCount
=
"250"
/>
|
第三个是文档缓存:
1
|
<
documentCache
class
=
"solr.FastLRUCache"
size
=
"11000"
initialSize
=
"11000"
/>
|
这几个配置是基于以上的几个假设的值进行调优的。
动态字段
正常情况下,需要事先把知道的字段定义在 schema.xml 中,当有不确定的字段时,这时可以使用动态字段。
1
|
<
dynamicField
name
=
"*_s"
type
=
"string"
indexed
=
"true"
stored
=
"true"
/>
|
启用 solr suggest
suggest 是搜索引擎一个方便的功能,对数据的关键字进行预测和建议,减少了用户的输入,大体的效果如下:
1
2
3
4
5
6
7
8
9
|
<
searchComponent
name
=
"spellcheck"
class
=
"solr.SpellCheckComponent"
>
<
str
name
=
"queryAnalyzerFieldType"
>textSpell</
str
>
<
lst
name
=
"spellchecker"
>
<
str
name
=
"name"
>default</
str
>
<
str
name
=
"field"
>title</
str
>
<
str
name
=
"buildOnCommit"
>true</
str
>
<
str
name
=
"spellcheckIndexDir"
>spellchecker</
str
>
</
lst
>
</
searchComponent
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
<
searchComponent
class
=
"solr.SpellCheckComponent"
name
=
"suggest"
>
<
lst
name
=
"spellchecker"
>
<
str
name
=
"name"
>suggest</
str
>
<
str
name
=
"classname"
>org.apache.solr.spelling.suggest.Suggester</
str
>
<
str
name
=
"lookupImpl"
>org.apache.solr.spelling.suggest.tst.TSTLookupFactory</
str
>
<
float
name
=
"threshold"
>0.005</
float
>
<
str
name
=
"buildOnCommit"
>true</
str
>
</
lst
>
</
searchComponent
>
<
requestHandler
class
=
"org.apache.solr.handler.component.SearchHandler"
name
=
"/suggest"
>
<
lst
name
=
"defaults"
>
<
str
name
=
"spellcheck"
>true</
str
>
<
str
name
=
"spellcheck.dictionary"
>suggest</
str
>
<
str
name
=
"spellcheck.onlyMorePopular"
>true</
str
>
<
str
name
=
"spellcheck.count"
>5</
str
>
<
str
name
=
"spellcheck.collate"
>true</
str
>
</
lst
>
<
arr
name
=
"components"
>
<
str
>suggest</
str
>
</
arr
>
</
requestHandler
>
|
http://local
host:8983/so lr/suggest/? q=%E7%94%9F
会得到如下结果:
luke:lucene 索引查看工具
solr 启动小工具
在 solr 发行包中的 example 中,有一些 solr 的示例,运行起来即可体验 solr 的功能,启动 example 过程,正常需要打开命令行,cd 到 example 目录,然后运行
java -jar start.jar
启动 solr,这个在 下载和安装 solr章节已有说明,现在弄了命令行小工具,可以双击启动 solr,方法如下:
cd %~dp0 %~d0 java -jar start.jar
将以上文本另存为 bat 文件,保存在 example 目录下,这样,双击该 bat 文件即可启动 solr, 跟 tomcat 的 start.bat 功能类似。没什么技术含量,纯为了方便。