0

I am trying to query solr using solrj and I can't seem to find the way to and a fq argument to my code

here is the http request I am trying to run

select?wt=json&indent=true&fl=name,store&q=*:*&fq=!geofilt%20pt=45.15,-93.85%20sfield=store%20d=5}

and here is my code

SolrServer server = new HttpSolrServer("the host");
SolrQuery query = new SolrQuery();
query.setQuery( "*" );
query.setParam("fl","name,price");

How do I add the setParam for the fq "!geofilt pt=45.15,-93.85 sfield=store d=5" I assume it is something line query.setParam("fq","the fq field") but nothing seems to work for me.

Thanks,

Shimon

Artem Lukanin
  • 556
  • 3
  • 15
Shimon Benattar
  • 173
  • 1
  • 3
  • 9

2 Answers2

4

Can you use addFilterQuery?

SolrQuery query = new SolrQuery();
query.setQuery( "*" );
query.setParam("fl","name,price");
query.addFilterQuery("{!geofilt pt=45.15,-93.85 sfield=store d=5}");
Peter
  • 12,541
  • 3
  • 34
  • 39
0

You can also query like

query.set(CommonParams.FQ, "{!geofilt pt=45.15,-93.85 sfield=store d=5}");
buddy86
  • 1,434
  • 12
  • 20