简体   繁体   中英

nested filter query in apache solr

I have indexed huge data from database to apacheSolr, problem i I am not able to querying it , here I am sharing my java code

      parameters.set("q", "*:*");
      parameters.set("fl", "id,propertyName,locality,hotels");
      parameters.set("fq", "cityName:\""+cityName+"\"");
      parameters.set("wt", "json");
      parameters.set("rows", "600");
      parameters.set("indent", true);

its querying properly, if I add one more filter query like

     parameters.set("fq", "hotels:\""+hotels+"\"");

its overwriting city and shows only hotels , need to show hotels from the city Any help

I had a same issue earlier and here is the solution that I applied to resolve this issue:

parameters.addFilterQuery("hotels:\""+hotels+"\"","cityName:"+cityName);

Example:

parameters.addFilterQuery("hotels:\""+Marriot+"\"","cityName:"+Pune);

This query will show all the Marriot hotels from Pune City.

I hope this is what you are looking.

Hope this Helps!!!

Jayesh Bhoyar

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