0

I am trying to access a field in custom request handler. I am accessing it like this for each document:

Document doc;
doc = reader.document(id);
DocFields = doc.getValues("state");

There are around 600,000 documents in the solr. For a query running on all the docs, it is taking more than 65 seconds.

I have also tried SolrIndexSearcher.doc method, but it is also taking around 60 seconds.

Removing the above lines of code bring down the qtime to milliseconds. But, I need to access that field for my algo.

Is there a more optimised way to do this?

1 Answers1

0

It seems that you querying one document at a time which is slow. If you need to query all documents try to query *:*(instead of asking for a specific id) and then iterate over the results.

cheffe
  • 9,345
  • 2
  • 46
  • 57
  • I am already using `*:*` in my query. In the "custom request handler", I need a particular field value for each document to implement my algo. As mentioned above, the function call to get that field value for each doc is taking too much time. – Neeraj Lajpal Feb 13 '16 at 12:22
  • You are querying a specific id in your code. Couldn't you iterate in your Java code over what Solr returns to you? – Fabien Renaud Feb 13 '16 at 13:23
  • No, I can't. As I have already mentioned, I need it in the custom handler to run my algo on docs. In the custom handler, solr only returns Id and score of docs. I am trying to access another field(may have different values for each doc), which is a requirement for the algo to work. – Neeraj Lajpal Feb 13 '16 at 20:44
  • Please post your custom handler and the surrounding Java code. – Fabien Renaud Feb 15 '16 at 12:57