lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jamie <ja...@mailarchiva.com>
Subject Re: search performance
Date Fri, 06 Jun 2014 22:05:16 GMT
Jon

I ended up adapting your approach. The solution involves keeping a LRU 
cache of page boundary scoredocs and their respective positions. New 
positions are added to the cache as new pages are discovered. To cut 
down on searches, when scrolling backwards and forwards, the search 
begins from nearest cached position.

Cheers

Jamie

On 2014/06/03, 3:24 PM, Jon Stewart wrote:
> With regards to pagination, is there a way for you to cache the
> IndexSearcher, Query, and TopDocs between user pagination requests (a
> lot of webapp frameworks have object caching mechanisms)? If so, you
> may have luck with code like this:
>
>    void ensureTopDocs(final int rank) throws IOException {
>      if (StartDocIndex > rank) {
>        Docs = Searcher.search(SearchQuery, TOP_DOCS_WINDOW);
>        StartDocIndex = 0;
>      }
>      int len = Docs.scoreDocs.length;
>      while (StartDocIndex + len <= rank) {
>        StartDocIndex += len;
>        Docs = Searcher.searchAfter(Docs.scoreDocs[len - 1],
> SearchQuery, TOP_DOCS_WINDOW);
>        len = Docs.scoreDocs.length;
>      }
>    }
>


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message