I want to do ids query to SolrIndexSearcher (fetch several documents from solr using their ids) – something like ids query to SolrServer q=:&ids=ID1,ID2&fl=* .
I tried to call search(Query,int) in several ways with no success
i.e.
TopDocs results = this.indexSearcher.search(QueryParsing.parseQuery("q=\\*\\:\\*&ids=ID1,ID2&fl=*", this.indexSearcher.getSchema()) , MAX_DOCUMENTS);
results is allways empty..
thanks
You can search as
q=ids:(ID1 OR ID2)which will search for the ids.You can also use filter query
q=*:*&fq=ids:(ID1 OR ID2)which is a performant approach as it utilizes the Filter cache.