Faceting on distance in solr- how to generate links that search withing a given range of distance

穿精又带淫゛_ 提交于 2019-12-23 18:41:45

问题


It is fairly simple to generate facets for ranges or 'buckets' of distance in Solr: http://wiki.apache.org/solr/SpatialSearch#How_to_facet_by_distance

What isnt described is how to generate the links for these facets

If this is the query to return everything within 5km :

&q=:&fq={!geofilt sfield=store}&pt=45.15,-93.85&d=5

-what then would be the syntax to search for everything between 5 and 10km ?

Basically I can generate distance facets, but I dont know how to generate the links for the distance facets:

for example, what would the links for the following facets look like?:

distance

0-1km (2)

1-5km (0)

5-20km (0)

20-50km (0)

50-100km (0)

100-250km (0)


回答1:


The wiki does describe it:

&q=*:*&sfield=store&pt=45.15,-93.85&facet.query={!frange l=0 u=5}geodist()&facet.query={!frange l=5.001 u=3000}geodist()

This will generate a facet from 0 to 5km and another from 5km to 3000km. Change the values in frange according to your needs.

If you meant filtering with a range of distances, moving the facet query to a filter query should work, e.g. fq={!frange l=5.001 u=3000}geodist()



来源:https://stackoverflow.com/questions/6035270/faceting-on-distance-in-solr-how-to-generate-links-that-search-withing-a-given

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!