Search in sources :

Example 81 with SpanQuery

use of org.apache.lucene.search.spans.SpanQuery in project lucene-solr by apache.

the class TestMemoryIndexAgainstRAMDir method testPassesIfWrapped.

// LUCENE-3831
public void testPassesIfWrapped() throws IOException {
    RegexpQuery regex = new RegexpQuery(new Term("field", "worl."));
    SpanQuery wrappedquery = new SpanOrQuery(new SpanMultiTermQueryWrapper<>(regex));
    MemoryIndex mindex = randomMemoryIndex();
    mindex.addField("field", new MockAnalyzer(random()).tokenStream("field", "hello there"));
    // This passes though
    assertEquals(0, mindex.search(wrappedquery), 0.00001f);
    TestUtil.checkReader(mindex.createSearcher().getIndexReader());
}
Also used : MockAnalyzer(org.apache.lucene.analysis.MockAnalyzer) SpanOrQuery(org.apache.lucene.search.spans.SpanOrQuery) RegexpQuery(org.apache.lucene.search.RegexpQuery) SpanQuery(org.apache.lucene.search.spans.SpanQuery)

Aggregations

SpanQuery (org.apache.lucene.search.spans.SpanQuery)81 SpanTermQuery (org.apache.lucene.search.spans.SpanTermQuery)53 Term (org.apache.lucene.index.Term)51 SpanNearQuery (org.apache.lucene.search.spans.SpanNearQuery)43 Query (org.apache.lucene.search.Query)27 SpanOrQuery (org.apache.lucene.search.spans.SpanOrQuery)25 IndexReader (org.apache.lucene.index.IndexReader)18 SpanBoostQuery (org.apache.lucene.search.spans.SpanBoostQuery)18 Document (org.apache.lucene.document.Document)17 IndexSearcher (org.apache.lucene.search.IndexSearcher)16 BooleanQuery (org.apache.lucene.search.BooleanQuery)15 TopDocs (org.apache.lucene.search.TopDocs)15 RandomIndexWriter (org.apache.lucene.index.RandomIndexWriter)13 TermQuery (org.apache.lucene.search.TermQuery)13 ArrayList (java.util.ArrayList)12 Spans (org.apache.lucene.search.spans.Spans)12 PhraseQuery (org.apache.lucene.search.PhraseQuery)11 DisjunctionMaxQuery (org.apache.lucene.search.DisjunctionMaxQuery)10 SpanNotQuery (org.apache.lucene.search.spans.SpanNotQuery)10 Directory (org.apache.lucene.store.Directory)10