Package org.apache.lucene.search.spans
Class SpanTestUtil
- java.lang.Object
-
- org.apache.lucene.search.spans.SpanTestUtil
-
public class SpanTestUtil extends Object
Some utility methods used for testing span queries
-
-
Constructor Summary
Constructors Constructor Description SpanTestUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
assertFinished(Spans spans)
Assert thatspans
is exhausted.static void
assertNext(Spans spans, int doc, int start, int end)
Assert the next iteration fromspans
is a match fromstart
toend
indoc
.static SpanQuery
spanContainingQuery(SpanQuery big, SpanQuery little)
Makes a new SpanContainingQuery (with additional asserts).static SpanQuery
spanFirstQuery(SpanQuery query, int end)
Makes a new SpanFirstQuery (with additional asserts).static SpanQuery
spanNearOrderedQuery(int slop, SpanQuery... subqueries)
Makes a new ordered SpanNearQuery (with additional asserts)static SpanQuery
spanNearOrderedQuery(String field, int slop, String... terms)
Makes a new ordered SpanNearQuery (with additional asserts) from the providedterms
static SpanQuery
spanNearUnorderedQuery(int slop, SpanQuery... subqueries)
Makes a new unordered SpanNearQuery (with additional asserts)static SpanQuery
spanNearUnorderedQuery(String field, int slop, String... terms)
Makes a new unordered SpanNearQuery (with additional asserts) from the providedterms
static SpanQuery
spanNotQuery(SpanQuery include, SpanQuery exclude)
Makes a new SpanNotQuery (with additional asserts).static SpanQuery
spanNotQuery(SpanQuery include, SpanQuery exclude, int pre, int post)
Makes a new SpanNotQuery (with additional asserts).static SpanQuery
spanOrQuery(String field, String... terms)
Makes a new SpanOrQuery (with additional asserts) from the providedterms
.static SpanQuery
spanOrQuery(SpanQuery... subqueries)
Makes a new SpanOrQuery (with additional asserts).static SpanQuery
spanPositionRangeQuery(SpanQuery query, int start, int end)
Makes a new SpanPositionRangeQuery (with additional asserts).static SpanQuery
spanQuery(SpanQuery query)
Adds additional asserts to a spanquery.static SpanQuery
spanTermQuery(String field, String term)
Makes a new SpanTermQuery (with additional asserts).static SpanQuery
spanWithinQuery(SpanQuery big, SpanQuery little)
Makes a new SpanWithinQuery (with additional asserts).
-
-
-
Method Detail
-
spanQuery
public static SpanQuery spanQuery(SpanQuery query)
Adds additional asserts to a spanquery. Highly recommended if you want tests to actually be debuggable.
-
spanTermQuery
public static SpanQuery spanTermQuery(String field, String term)
Makes a new SpanTermQuery (with additional asserts).
-
spanOrQuery
public static SpanQuery spanOrQuery(String field, String... terms)
Makes a new SpanOrQuery (with additional asserts) from the providedterms
.
-
spanOrQuery
public static SpanQuery spanOrQuery(SpanQuery... subqueries)
Makes a new SpanOrQuery (with additional asserts).
-
spanNotQuery
public static SpanQuery spanNotQuery(SpanQuery include, SpanQuery exclude)
Makes a new SpanNotQuery (with additional asserts).
-
spanNotQuery
public static SpanQuery spanNotQuery(SpanQuery include, SpanQuery exclude, int pre, int post)
Makes a new SpanNotQuery (with additional asserts).
-
spanFirstQuery
public static SpanQuery spanFirstQuery(SpanQuery query, int end)
Makes a new SpanFirstQuery (with additional asserts).
-
spanPositionRangeQuery
public static SpanQuery spanPositionRangeQuery(SpanQuery query, int start, int end)
Makes a new SpanPositionRangeQuery (with additional asserts).
-
spanContainingQuery
public static SpanQuery spanContainingQuery(SpanQuery big, SpanQuery little)
Makes a new SpanContainingQuery (with additional asserts).
-
spanWithinQuery
public static SpanQuery spanWithinQuery(SpanQuery big, SpanQuery little)
Makes a new SpanWithinQuery (with additional asserts).
-
spanNearOrderedQuery
public static SpanQuery spanNearOrderedQuery(String field, int slop, String... terms)
Makes a new ordered SpanNearQuery (with additional asserts) from the providedterms
-
spanNearOrderedQuery
public static SpanQuery spanNearOrderedQuery(int slop, SpanQuery... subqueries)
Makes a new ordered SpanNearQuery (with additional asserts)
-
spanNearUnorderedQuery
public static SpanQuery spanNearUnorderedQuery(String field, int slop, String... terms)
Makes a new unordered SpanNearQuery (with additional asserts) from the providedterms
-
spanNearUnorderedQuery
public static SpanQuery spanNearUnorderedQuery(int slop, SpanQuery... subqueries)
Makes a new unordered SpanNearQuery (with additional asserts)
-
assertNext
public static void assertNext(Spans spans, int doc, int start, int end) throws IOException
Assert the next iteration fromspans
is a match fromstart
toend
indoc
.- Throws:
IOException
-
-