Class MatchesTestBase

    • Constructor Detail

      • MatchesTestBase

        public MatchesTestBase()
    • Method Detail

      • getDocuments

        protected abstract String[] getDocuments()
        Returns:
        an array of documents to be indexed
      • checkMatches

        protected void checkMatches​(Query q,
                                    String field,
                                    int[][] expected)
                             throws IOException
        For a given query and field, check that expected matches are retrieved
        Parameters:
        q - the query
        field - the field to pull matches from
        expected - an array of arrays of ints; for each entry, the first int is the expected docid, followed by pairs of start and end positions
        Throws:
        IOException
      • checkLabelCount

        protected void checkLabelCount​(Query q,
                                       String field,
                                       int[] expected)
                                throws IOException
        For a given query and field, check that the expected numbers of query labels were found
        Parameters:
        q - the query
        field - the field to pull matches from
        expected - an array of expected label counts, one entry per document
        Throws:
        IOException
      • checkFieldMatches

        protected void checkFieldMatches​(MatchesIterator it,
                                         int[] expected)
                                  throws IOException
        Given a MatchesIterator, check that it has the expected set of start and end positions
        Parameters:
        it - an iterator
        expected - an array of expected start and end pairs and start and end offsets; the entry at position 0 is ignored
        Throws:
        IOException
      • checkNoPositionsMatches

        protected void checkNoPositionsMatches​(Query q,
                                               String field,
                                               boolean[] expected)
                                        throws IOException
        Given a query and field, check that matches are returned from expected documents and that they return -1 for start and end positions
        Parameters:
        q - the query
        field - the field to pull matches from
        expected - an array of booleans indicating if matches are expected from each document
        Throws:
        IOException
      • checkSubMatches

        protected void checkSubMatches​(Query q,
                                       String[][] expectedNames)
                                throws IOException
        Given a query, check that matches contain the expected NamedQuery wrapper names
        Parameters:
        q - the query
        expectedNames - an array of arrays of Strings; for each document, an array of expected query names that match
        Throws:
        IOException
      • assertIsLeafMatch

        protected void assertIsLeafMatch​(Query q,
                                         String field)
                                  throws IOException
        Assert that query matches from a field are all leaf matches and do not contain sub matches
        Parameters:
        q - the query
        field - the field
        Throws:
        IOException
      • checkTermMatches

        protected void checkTermMatches​(Query q,
                                        String field,
                                        MatchesTestBase.TermMatch[][][] expected)
                                 throws IOException
        For a query and field, check that each document's submatches conform to an expected TermMatch
        Parameters:
        q - the query
        field - the field to pull matches for
        expected - an array per doc of arrays per match of an array of expected submatches
        Throws:
        IOException