solrj - How to check if a solr query will return data before actually loading the data? -


I am going to write some code which will run several solr queries. But whenever I run the query, these questions do not need to be loaded with documents. I mean, I can run 6 questions but I can load the documents from the 5th query only May need to be done.

So to speed things up, there is a way to run a sulter query which only indicates that this query will return the document or not? My goal document is not to load until I actually use them. Just to accelerate the process.

There are two ways to achieve this:

  • You can set the field list to go back by using the fl parameter: Set the empty string or set the field name that does not exist in your index so that the request is not fallback in the default field list blank should return a list of documents:

     SolrQuery query = new solverkey (); Query.setQuery ("Something to Search"); Query.set ("fl", "unknown_field"); SolrDocumentList Out = server.query (Query) .getResults (); 
  • Use the rows parameter (must be preferred), ask solr to return 0 documents:

     query. SetRows (0); Server.query (query) .getResults (); 
  • In both cases, getNumFound () method should be returned to the number of documents matched.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -