简体   繁体   中英

Solr location facet search

I'm using solr to do faceted search. I'm populated the data in Solr and a typical document looks like:

<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>

When I run a query: {!geofilt pt=37.3320927,-121.90056663 d=100 sfield=location d=5} I get 2 documents back. Similarly, when I run: {!geofilt pt=37.3320927,-121.90056663 d=100 sfield=location d=50} I get 6 documents back.

But when I run the query:

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

I get a response:

Similarly for:

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

I get a response:

Is there anything that I'm doing incorrectly?

I got things to work by using the query:

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

The next problems is how do I added another facet to the query? Specifically, in this case I'd like to break up the results using media_type.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM