Class PensieveSeeker

    • Constructor Detail

      • PensieveSeeker

        public PensieveSeeker​(org.apache.lucene.store.Directory indexDir)
                       throws IllegalArgumentException
        Creates an instance of TMSeeker
        Parameters:
        indexDir - The Directory implementation to use for the queries
        Throws:
        IllegalArgumentException - If the indexDir is not set
      • PensieveSeeker

        public PensieveSeeker​(org.apache.lucene.index.IndexWriter indexWriter)
                       throws IllegalArgumentException
        Creates an instance of TMSeeker. This constructor is used for near-real-time (NRT) mode to make index changes visible to a new searcher with fast turn-around time.
        Parameters:
        indexWriter - The IndexWriter implementation to use for the queries, needed for NRT
        Throws:
        IllegalArgumentException - If the indexDir is not set
    • Method Detail

      • getIndexDir

        public org.apache.lucene.store.Directory getIndexDir()
        Get the current Lucene Directory
        Returns:
        the current Lucene Directory
      • createIndexSearcher

        protected org.apache.lucene.search.IndexSearcher createIndexSearcher()
                                                                      throws org.apache.lucene.index.CorruptIndexException,
                                                                             IOException
        Throws:
        org.apache.lucene.index.CorruptIndexException
        IOException
      • getIndexSearcher

        protected org.apache.lucene.search.IndexSearcher getIndexSearcher()
                                                                   throws org.apache.lucene.index.CorruptIndexException,
                                                                          IOException
        Throws:
        org.apache.lucene.index.CorruptIndexException
        IOException
      • openIndexReader

        protected org.apache.lucene.index.IndexReader openIndexReader()
                                                               throws org.apache.lucene.index.CorruptIndexException,
                                                                      IOException
        Throws:
        org.apache.lucene.index.CorruptIndexException
        IOException
      • searchExact

        public List<TmHit> searchExact​(TextFragment query,
                                       Metadata metadata)
        Description copied from interface: ITmSeeker
        Get a list of exact matches for a given text fragment, taking inline codes in account.
        Specified by:
        searchExact in interface ITmSeeker
        Parameters:
        query - the fragment to search for
        metadata - the metadata attributes to also match against, null for no metadata.
        Returns:
        a list of exact matches
      • searchFuzzy

        public List<TmHit> searchFuzzy​(TextFragment queryFrag,
                                       int threshold,
                                       int max,
                                       Metadata metadata)
        Search for exact and fuzzy matches
        Specified by:
        searchFuzzy in interface ITmSeeker
        Parameters:
        queryFrag - the fragment to query.
        threshold - the minimal score value to return.
        max - the maximum number of hits to return.
        metadata - any associated attributes to use for filter.
        Returns:
        the list of hits of the given argument.
        Throws:
        IllegalArgumentException - If threshold is greater than 100 or less than 0