Interface MemoryIndex

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void close()
      Closes the MemoryIndex.
      org.apache.lucene.document.Document getDocument​(int documentId)
      Retrieves a document from the Index.
      void open​(java.util.Set<Pair<java.lang.String,​java.lang.String>> data, Settings settings)
      Creates and loads data into an in memory index.
      org.apache.lucene.search.Query parseQuery​(java.lang.String searchString)
      Parses the given string into a Lucene Query.
      org.apache.lucene.search.TopDocs search​(java.lang.String searchString, int maxQueryResults)
      Searches the index using the given search string.
      org.apache.lucene.search.TopDocs search​(org.apache.lucene.search.Query query, int maxQueryResults)
      Searches the index using the given query.
    • Method Detail

      • getDocument

        org.apache.lucene.document.Document getDocument​(int documentId)
                                                 throws java.io.IOException
        Retrieves a document from the Index.
        Parameters:
        documentId - the id of the document to retrieve
        Returns:
        the Document
        Throws:
        java.io.IOException - thrown if there is an IOException
      • open

        void open​(java.util.Set<Pair<java.lang.String,​java.lang.String>> data,
                  Settings settings)
           throws IndexException
        Creates and loads data into an in memory index.
        Parameters:
        data - the CPE data
        settings - a reference to the dependency-check settings
        Throws:
        IndexException - thrown if there is an error creating the index
      • parseQuery

        org.apache.lucene.search.Query parseQuery​(java.lang.String searchString)
                                           throws org.apache.lucene.queryparser.classic.ParseException,
                                                  IndexException
        Parses the given string into a Lucene Query.
        Parameters:
        searchString - the search text
        Returns:
        the Query object
        Throws:
        org.apache.lucene.queryparser.classic.ParseException - thrown if the search text cannot be parsed
        IndexException - thrown if there is an error resetting the analyzers
      • search

        org.apache.lucene.search.TopDocs search​(java.lang.String searchString,
                                                int maxQueryResults)
                                         throws org.apache.lucene.queryparser.classic.ParseException,
                                                IndexException,
                                                java.io.IOException
        Searches the index using the given search string.
        Parameters:
        searchString - the query text
        maxQueryResults - the maximum number of documents to return
        Returns:
        the TopDocs found by the search
        Throws:
        org.apache.lucene.queryparser.classic.ParseException - thrown when the searchString is invalid
        IndexException - thrown when there is an internal error resetting the search analyzer
        java.io.IOException - is thrown if there is an issue with the underlying Index
      • search

        org.apache.lucene.search.TopDocs search​(org.apache.lucene.search.Query query,
                                                int maxQueryResults)
                                         throws org.apache.lucene.index.CorruptIndexException,
                                                java.io.IOException
        Searches the index using the given query.
        Parameters:
        query - the query used to search the index
        maxQueryResults - the max number of results to return
        Returns:
        the TopDocs found be the query
        Throws:
        org.apache.lucene.index.CorruptIndexException - thrown if the Index is corrupt
        java.io.IOException - thrown if there is an IOException
      • close

        void close()
        Closes the MemoryIndex.
        Specified by:
        close in interface java.lang.AutoCloseable