2012-06-04 91 views
0

我正在使用solr进行多面搜索。 我Solr中填充数据和典型的文件看起来像:Solr位置方面搜索

<doc> 
<str name="id">1</str> 
<date name="last_modified">2012-06-03T07:23:11.215Z</date> 
<str name="location">22.60325666,114.1371245</str> 
<int name="media_type">0</int> 
</doc> 

当我运行一个查询: {!geofilt PT = 37.3320927,-121.90056663 d = 100元数=位置d = 5} 我收到2份文件。同样,当我运行: {!geofilt pt = 37.3320927,-121.90056663 d = 100 sfield =位置d = 50} 我收到6个文件。

但是当我运行查询:

http://localhost:8983/solr/select?sfield=location&pt=37.3320927,-121.90056663&facet.query={!geofilt%20d=10%20key=d10}&facet.query={!geofilt%20d=20%20key=d20}&facet.query={!geofilt%20d=50%20key=d50}&wt=xml&facet=true 

我得到回应:

同样为:

http://localhost:8983/solr/select?sfield=location&pt=37.3320927,-121.90056663&facet.query={!geofilt%20d=10%20key=d10}&facet.query={!geofilt%20d=20%20key=d20}&facet.query={!geofilt%20d=50%20key=d50}&wt=xml&facet=true 

我得到回应:

有我做错了什么?

+0

即使我有media_type定义为,我仍然不能运行一个分面搜索:http:// localhost:8983/solr/select?q = *。*&rows = 0&facet = true&facet.query = media_type:1&facet.query = media_type:2 –

回答

0

我得到的东西通过查询工作:

http://localhost:8983/solr/select?q=*:*&sfield=location&pt=37.3320927,-121.90056663&facet.query={!frange l=0 u=5}geodist()&facet.query={!frange l=5.001 u=20.0}geodist()& &facet.query={!frange l=20.001 u=100}geodist()&facet.pivot=media_type&wt=xml&facet=true&rows=0 

下一个问题是我怎么添加了另一个方面的查询? 具体而言,在这种情况下,我想用media_type分解结果。

+0

我相信Solr支持多个'fq ='查询参数,所以您只需在URL中添加另一个。 –