Class LuceneQueryHits

  • All Implemented Interfaces:
    CloseableHits, QueryHits

    public class LuceneQueryHits
    extends Object
    implements QueryHits
    Wraps a lucene query result and adds a close method that allows to release resources after a query has been executed and the results have been read completely.
    • Constructor Detail

      • LuceneQueryHits

        public LuceneQueryHits​(org.apache.lucene.index.IndexReader reader,
                               org.apache.lucene.search.IndexSearcher searcher,
                               org.apache.lucene.search.Query query)
                        throws IOException
        Throws:
        IOException
    • Method Detail

      • nextScoreNode

        public ScoreNode nextScoreNode()
                                throws IOException
        Returns the next score node in this QueryHits or null if there are no more score nodes.
        Specified by:
        nextScoreNode in interface QueryHits
        Returns:
        the next score node in this QueryHits.
        Throws:
        IOException - if an error occurs while reading from the index.
      • close

        public void close()
                   throws IOException
        Releases resources held by this hits instance.
        Specified by:
        close in interface CloseableHits
        Throws:
        IOException - if an error occurs while releasing resources.
      • getSize

        public int getSize()
        Specified by:
        getSize in interface CloseableHits
        Returns:
        always -1.
      • skip

        public void skip​(int n)
                  throws IOException
        Skips a n score nodes.
        Specified by:
        skip in interface CloseableHits
        Parameters:
        n - the number of score nodes to skip.
        Throws:
        IOException - if an error occurs while skipping.