java - Solr SearchComponent get all documents -


i'm writing solr plugin (searchcomponent) , want iterate on documents found query. part of code in process method:

    // searcher search document     solrindexsearcher searcher  = rb.req.getsearcher();     // getting list of documents found query     doclist docs = rb.getresults().doclist;     // return if no results found query     if (docs == null || docs.size() == 0) {         return;     }     // iterator documents returned     dociterator iterator = docs.iterator();     // iterate on documents , count occurrences     (int = 0; < docs.size(); i++) {         try {             // getting current document id             int docid = iterator.nextdoc();             // fetch document searcher             document doc = searcher.doc(docid);             // stuff         } catch (exception e) {             logger.error(e.getmessage());         }     } 

for found method can iterate on documents returned i.e. if 1300 documents found query , return 20, iterate on 20 method now. there possibility full set of documents (1300)?

there possibility that. use doclist contains 'rows' docs starting 'start'. if want iterate on 'numfound' docs - use docset via

rb.getresults().docset 

for understanding of mechanism - http://wiki.apache.org/solr/faq#how_can_i_get_all_the_matching_documents_back.3f_..._how_can_i_return_an_unlimited_number_of_rows.3f


Comments

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

The canvas has been tainted by cross-origin data in chrome only -