`
JLK
  • 浏览: 233235 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

solr 1.3 更多扩展点

    博客分类:
  • solr
阅读更多

Solr 1.3 中,扩展 Solr 以及配置和重新整理扩展变得十分简单。以前,您需要编写一个 SolrRequestHandler 来实现新功能。这个方法的问题是其他 SolrRequestHandler 很难重用该功能。例如,您可能有更好的分类方法,但却想保留现有的查询与突出显示功能。为了解决这个问题,Solr 项目提出了将各种 SolrRequestHandler(比如 StandardRequestHandler DismaxRequestHandler)重构为组件称为 SearchComponent — 的想法,这些组件可以链接起来,形成一个新的 SolrRequestHandler。现在,您只要关注 SearchComponent 的新功能就可以了,不用再费神思考怎样才能最好地扩展、重用或复制其他功能。

不过请放心,现有的 SolrRequestHandler 仍然可以像以前一样无缝地工作,但它们现在仅仅是负责实际工作的围绕 SearchComponent 的包装器而已。表 1 介绍了一些新 SearchComponent 的详细信息。稍后,我还将在本文中提供有关表 1 中的两个组件的更多信息(MoreLikeThisComponent SpellCheckComponent。参见 参考资料 中的 SearchComponent 链接)。

1. 常用的 SearchComponent
名称 说明和查询样例
QueryComponent 
负责将查询提交到 Lucene 并返回 Document 的列表。

http://localhost:8983/solr/select?&q=iPod&start=0&rows=10 
FacetComponent 
决定结果集的分类。

http://localhost:8983/solr/select?&q=iPod&start=0&rows=10&facet=true&facet.field=inStock 
MoreLikeThisComponent 
为每个搜索结果查找与结果类似的文档,并返回这些结果。

http://localhost:8983/solr/select?&q=iPod&start=0&rows=10&mlt=true&mlt.fl=features&mlt.count=1 
HighlightComponent 
在搜索结果的正文中突出显示查询词语的位置。

http://localhost:8983/solr/select?&q=iPod&start=0&rows=10&hl=true&hl.fl=name 
DebugComponent 
返回有关查询的解析方式的信息,以及每个文档的记录方式的详细信息。

http://localhost:8983/solr/select?&q=iPod&start=0&rows=10&debugQuery=true 
SpellCheckComponent 
根据索引的内容对输入查询进行拼写检查,并提供其他备选方法。

http://localhost:8983/solr/spellCheckCompRH?&q=iPood&start=0&rows=10&spellcheck=true&spellcheck.build=true  

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics