图解全文检索SOLR的酷应用[Ajax Solr]

Ajax Solr 是一个使用客户端Javascript库实现的基于Solr的应用库,提供了丰富的应用功能。

Ajax Solr is a client-side JavaScript library that can access Solr via its REST-like interface. Solr is not properly a database, but a search server; however it is the main data source for a search-based application. The result of using Ajax Solr for the user interface is literally having a JDBC (or PDO) Api available in the browser, which can make queries and change the results displayed basing on events generated by the user.

官方主页和具体的介绍

https://github.com/evolvingweb/ajax-solr

http://www.renren.it/a/JAVAbiancheng/JAVAzonghe/20100909/client-applications-ajax-solr.html

http://java.dzone.com/articles/client-applications-ajax-solr

 

例子Reuters tutorial:

https://github.com/evolvingweb/ajax-solr/wiki/reuters-tutorial

http://wenku.baidu.com/view/6830cd10f18583d04964590d.html

例子的下载:http://github.com/evolvingweb/ajax-solr/zipball/gh-pages 

解压下载的文件,其中examples就是如下的具体效果,docs是库的API Docs说明,非常详细;lib就是这个库的javascript源代码

 

如下是每个例子的具体效果,可见关于搜索的各个方面在这个库基础都有丰富的体现,对于我们的常见应用有借鉴意义。

【如下的例子分步的差别使用红色框标注】

· Step 1: Talk to Solr

· Step 2: Add a results widget

图片1

· Step 3: Add a pager widget

图片2

· Step 4: Add a tagcloud widget

图片3

· Step 5: Display the current filters

图片4

· Step 6: Add a free-text widget

图片5

· Step 7: Add an autocomplete widget

图片6

· Step 8: Add a map widget

图片7

· Step 9: Add a calendar widget

图片8

Step 10: Extra credit

图片9

基础

以上应用的具体服务都是基于Solr的服务返回的Json数据,具体请求类似如下:

http://evolvingweb.ca/solr/reuters/select?facet=true&q=*%3A*&facet.field=topics&facet.field=organisations&facet.field=exchanges&facet.field=countryCodes&facet.limit=20&facet.mincount=1&f.topics.facet.limit=50&f.countryCodes.facet.limit=-1&facet.date=date&facet.date.start=1987-02-26T00%3A00%3A00.000Z%2FDAY&facet.date.end=1987-10-20T00%3A00%3A00.000Z%2FDAY%2B1DAY&facet.date.gap=%2B1DAY&json.nl=map&wt=json&json.wrf=jsonp1313733083156&_=1313733083258

 

http://evolvingweb.ca/solr/reuters/select?q=*:*&rows=0&facet=true&facet.limit=-1&facet.mincount=1&json.nl=map&facet.field=topics&facet.field=organisations&facet.field=exchanges&wt=json&json.wrf=jsonp1313733083157&_=1313733084113

posted @ 2011-08-19 18:20  2012  阅读(2634)  评论(0编辑  收藏  举报