tags:

views:

1381

answers:

1
+1  Q: 

SolrJ Query

Hallo everyone,

i have to query multiple values against an index (just like a IN (id1, id2, id3) sql query ) using SolrJ, in other words i want to retrieve docs which field matches with a set of values.

As solrj api is rough documented i expect someone could help me

Regards

+1  A: 

You could do something like:

SolrQuery solrQuery = new SolrQuery().setQuery("myField:id1 OR myField:id2 OR myField:id3");
QueryResponse rsp = server.query(solrQuery);

or:

SolrQuery solrQuery = new SolrQuery().setQuery("myField:(id1 OR id2 OR id3)");
QueryResponse rsp = server.query(solrQuery);
Mauricio Scheffer
riggt, it's my fault i haven't explain the question well.What i want to do it's to implement same functionality avoiding OR -- OR .. OR (the solr query isn't implement it? )thx
Lici
see my edited answer, I just added another solution
Mauricio Scheffer
I'll try. Hope it works with a filter query ...
Lici
You'll probably get better answers on the solr-user mailing list
Mauricio Scheffer
Yeah, it works in a fq :-) thx
Lici