private void InitBlock(Lucene.Net.Index.IndexReader reader, SpanNotQuery enclosingInstance) { this.reader = reader; this.enclosingInstance = enclosingInstance; includeSpans = Enclosing_Instance.include.GetSpans(reader); excludeSpans = Enclosing_Instance.exclude.GetSpans(reader); }
public virtual void TestStartPositions() { Directory dir = NewDirectory(); // mimic StopAnalyzer CharacterRunAutomaton stopSet = new CharacterRunAutomaton((new RegExp("the|a|of")).ToAutomaton()); Analyzer analyzer = new MockAnalyzer(Random(), MockTokenizer.SIMPLE, true, stopSet); RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, analyzer); Document doc = new Document(); doc.Add(NewTextField("field", "the quick brown fox", Field.Store.NO)); writer.AddDocument(doc); Document doc2 = new Document(); doc2.Add(NewTextField("field", "quick brown fox", Field.Store.NO)); writer.AddDocument(doc2); IndexReader reader = writer.Reader; IndexSearcher searcher = NewSearcher(reader); // user queries on "starts-with quick" SpanQuery sfq = new SpanFirstQuery(new SpanTermQuery(new Term("field", "quick")), 1); Assert.AreEqual(1, searcher.Search(sfq, 10).TotalHits); // user queries on "starts-with the quick" SpanQuery include = new SpanFirstQuery(new SpanTermQuery(new Term("field", "quick")), 2); sfq = new SpanNotQuery(include, sfq); Assert.AreEqual(1, searcher.Search(sfq, 10).TotalHits); writer.Dispose(); reader.Dispose(); dir.Dispose(); }
private int SpanCount(string include, string exclude, int pre, int post) { SpanTermQuery iq = new SpanTermQuery(new Term(field, include)); SpanTermQuery eq = new SpanTermQuery(new Term(field, exclude)); SpanNotQuery snq = new SpanNotQuery(iq, eq, pre, post); Spans spans = MultiSpansWrapper.Wrap(Searcher.TopReaderContext, snq); int i = 0; while (spans.Next()) { i++; } return(i); }
public virtual void TestSpanNotWindowDoubleExcludesBefore() { //test hitting two excludes before an include SpanTermQuery term1 = new SpanTermQuery(new Term("field", "forty")); SpanTermQuery term2 = new SpanTermQuery(new Term("field", "two")); SpanNearQuery near = new SpanNearQuery(new SpanTermQuery[] { term1, term2 }, 2, true); SpanTermQuery exclude = new SpanTermQuery(new Term("field", "one")); SpanNotQuery query = new SpanNotQuery(near, exclude, 4, 1); CheckHits(query, new int[] { 42, 242, 342, 442, 542, 642, 742, 842, 942 }); Assert.IsTrue(Searcher.Explain(query, 242).Value > 0.0f); Assert.IsTrue(Searcher.Explain(query, 942).Value > 0.0f); }
/// <summary>Returns true iff <code>o</code> is equal to this. </summary> public override bool Equals(System.Object o) { if (this == o) { return(true); } if (!(o is SpanNotQuery)) { return(false); } SpanNotQuery other = (SpanNotQuery)o; return(this.include.Equals(other.include) && this.exclude.Equals(other.exclude) && this.GetBoost() == other.GetBoost()); }
public virtual void TestNpeInSpanNearWithSpanNot() { SpanTermQuery term1 = new SpanTermQuery(new Term("field", "eight")); SpanTermQuery term2 = new SpanTermQuery(new Term("field", "one")); SpanNearQuery near = new SpanNearQuery(new SpanQuery[] { term1, term2 }, 4, true); SpanTermQuery hun = new SpanTermQuery(new Term("field", "hundred")); SpanTermQuery term3 = new SpanTermQuery(new Term("field", "forty")); SpanNearQuery exclude = new SpanNearQuery(new SpanQuery[] { hun, term3 }, 1, true); SpanNotQuery query = new SpanNotQuery(near, exclude); CheckHits(query, new int[] { 801, 821, 831, 851, 861, 871, 881, 891, 1801, 1821, 1831, 1851, 1861, 1871, 1881, 1891 }); Assert.IsTrue(Searcher.Explain(query, 801).Value > 0.0f); Assert.IsTrue(Searcher.Explain(query, 891).Value > 0.0f); }
public override SpanQuery GetSpanQuery(XmlElement e) { XmlElement includeElem = DOMUtils.GetChildByTagOrFail(e, "Include"); includeElem = DOMUtils.GetFirstChildOrFail(includeElem); XmlElement excludeElem = DOMUtils.GetChildByTagOrFail(e, "Exclude"); excludeElem = DOMUtils.GetFirstChildOrFail(excludeElem); SpanQuery include = factory.GetSpanQuery(includeElem); SpanQuery exclude = factory.GetSpanQuery(excludeElem); SpanNotQuery snq = new SpanNotQuery(include, exclude); snq.Boost = DOMUtils.GetAttribute(e, "boost", 1.0f); return snq; }
public virtual void TestSpanWithMultipleNotSingle() { SpanTermQuery term1 = new SpanTermQuery(new Term("field", "eight")); SpanTermQuery term2 = new SpanTermQuery(new Term("field", "one")); SpanNearQuery near = new SpanNearQuery(new SpanQuery[] { term1, term2 }, 4, true); SpanTermQuery term3 = new SpanTermQuery(new Term("field", "forty")); SpanOrQuery or = new SpanOrQuery(term3); SpanNotQuery query = new SpanNotQuery(near, or); CheckHits(query, new int[] { 801, 821, 831, 851, 861, 871, 881, 891, 1801, 1821, 1831, 1851, 1861, 1871, 1881, 1891 }); Assert.IsTrue(Searcher.Explain(query, 801).Value > 0.0f); Assert.IsTrue(Searcher.Explain(query, 891).Value > 0.0f); }
public virtual void TestSpanNotWindowNeg() { //test handling of invalid window < 0 SpanTermQuery term1 = new SpanTermQuery(new Term("field", "eight")); SpanTermQuery term2 = new SpanTermQuery(new Term("field", "one")); SpanNearQuery near = new SpanNearQuery(new SpanQuery[] { term1, term2 }, 4, true); SpanTermQuery term3 = new SpanTermQuery(new Term("field", "forty")); SpanOrQuery or = new SpanOrQuery(term3); SpanNotQuery query = new SpanNotQuery(near, or); CheckHits(query, new int[] { 801, 821, 831, 851, 861, 871, 881, 891, 1801, 1821, 1831, 1851, 1861, 1871, 1881, 1891 }); Assert.IsTrue(searcher.Explain(query, 801).Value > 0.0f); Assert.IsTrue(searcher.Explain(query, 891).Value > 0.0f); }
public virtual void TestSpanWithMultipleNotMany() { SpanTermQuery term1 = new SpanTermQuery(new Term("field", "eight")); SpanTermQuery term2 = new SpanTermQuery(new Term("field", "one")); SpanNearQuery near = new SpanNearQuery(new SpanQuery[] { term1, term2 }, 4, true); SpanTermQuery term3 = new SpanTermQuery(new Term("field", "forty")); SpanTermQuery term4 = new SpanTermQuery(new Term("field", "sixty")); SpanTermQuery term5 = new SpanTermQuery(new Term("field", "eighty")); SpanOrQuery or = new SpanOrQuery(new SpanQuery[] { term3, term4, term5 }); SpanNotQuery query = new SpanNotQuery(near, or); CheckHits(query, new int[] { 801, 821, 831, 851, 871, 891 }); Assert.IsTrue(searcher.Explain(query, 801, null).Value > 0.0f); Assert.IsTrue(searcher.Explain(query, 891, null).Value > 0.0f); }
public virtual void TestStartPositions() { Directory dir = NewDirectory(); // mimic StopAnalyzer CharacterRunAutomaton stopSet = new CharacterRunAutomaton((new RegExp("the|a|of")).ToAutomaton()); Analyzer analyzer = new MockAnalyzer(Random, MockTokenizer.SIMPLE, true, stopSet); RandomIndexWriter writer = new RandomIndexWriter( #if FEATURE_INSTANCE_TESTDATA_INITIALIZATION this, #endif Random, dir, analyzer); Document doc = new Document(); doc.Add(NewTextField("field", "the quick brown fox", Field.Store.NO)); writer.AddDocument(doc); Document doc2 = new Document(); doc2.Add(NewTextField("field", "quick brown fox", Field.Store.NO)); writer.AddDocument(doc2); IndexReader reader = writer.GetReader(); IndexSearcher searcher = NewSearcher(reader); // user queries on "starts-with quick" SpanQuery sfq = new SpanFirstQuery(new SpanTermQuery(new Term("field", "quick")), 1); Assert.AreEqual(1, searcher.Search(sfq, 10).TotalHits); // user queries on "starts-with the quick" SpanQuery include = new SpanFirstQuery(new SpanTermQuery(new Term("field", "quick")), 2); sfq = new SpanNotQuery(include, sfq); Assert.AreEqual(1, searcher.Search(sfq, 10).TotalHits); writer.Dispose(); reader.Dispose(); dir.Dispose(); }
public virtual void TestSpanNot() { SpanQuery[] clauses = new SpanQuery[2]; clauses[0] = new SpanTermQuery(new Term(PayloadHelper.FIELD, "one")); clauses[1] = new SpanTermQuery(new Term(PayloadHelper.FIELD, "three")); SpanQuery spq = new SpanNearQuery(clauses, 5, true); SpanNotQuery snq = new SpanNotQuery(spq, new SpanTermQuery(new Term(PayloadHelper.FIELD, "two"))); Directory directory = NewDirectory(); RandomIndexWriter writer = new RandomIndexWriter(Random(), directory, NewIndexWriterConfig(TEST_VERSION_CURRENT, new PayloadAnalyzer(this)).SetSimilarity(Similarity)); Document doc = new Document(); doc.Add(NewTextField(PayloadHelper.FIELD, "one two three one four three", Field.Store.YES)); writer.AddDocument(doc); IndexReader reader = writer.Reader; writer.Dispose(); CheckSpans(MultiSpansWrapper.Wrap(reader.Context, snq), 1, new int[] { 2 }); reader.Dispose(); directory.Dispose(); }
public virtual void TestNoSuchMultiTermsInNotNear() { //test to make sure non existent multiterms aren't throwing non-matching field exceptions FuzzyQuery fuzzyNoSuch = new FuzzyQuery(new Term("field", "noSuch"), 1, 0, 1, false); SpanQuery spanNoSuch = new SpanMultiTermQueryWrapper <MultiTermQuery>(fuzzyNoSuch); SpanQuery term = new SpanTermQuery(new Term("field", "brown")); SpanNotQuery notNear = new SpanNotQuery(term, spanNoSuch, 0, 0); Assert.AreEqual(1, Searcher.Search(notNear, 10).TotalHits); //flip notNear = new SpanNotQuery(spanNoSuch, term, 0, 0); Assert.AreEqual(0, Searcher.Search(notNear, 10).TotalHits); //both noSuch notNear = new SpanNotQuery(spanNoSuch, spanNoSuch, 0, 0); Assert.AreEqual(0, Searcher.Search(notNear, 10).TotalHits); WildcardQuery wcNoSuch = new WildcardQuery(new Term("field", "noSuch*")); SpanQuery spanWCNoSuch = new SpanMultiTermQueryWrapper <MultiTermQuery>(wcNoSuch); notNear = new SpanNotQuery(term, spanWCNoSuch, 0, 0); Assert.AreEqual(1, Searcher.Search(notNear, 10).TotalHits); RegexpQuery rgxNoSuch = new RegexpQuery(new Term("field", "noSuch")); SpanQuery spanRgxNoSuch = new SpanMultiTermQueryWrapper <MultiTermQuery>(rgxNoSuch); notNear = new SpanNotQuery(term, spanRgxNoSuch, 1, 1); Assert.AreEqual(1, Searcher.Search(notNear, 10).TotalHits); PrefixQuery prfxNoSuch = new PrefixQuery(new Term("field", "noSuch")); SpanQuery spanPrfxNoSuch = new SpanMultiTermQueryWrapper <MultiTermQuery>(prfxNoSuch); notNear = new SpanNotQuery(term, spanPrfxNoSuch, 1, 1); Assert.AreEqual(1, Searcher.Search(notNear, 10).TotalHits); }
private static void VisitQuery(SpanNotQuery query, AzureQueryLogger.IndentedTextWriter writer) { writer.WriteLine("Include:"); ++writer.Indent; AzureQueryLogger.VisitQuery(query.Include, writer); --writer.Indent; writer.WriteLine("Exclude:"); ++writer.Indent; AzureQueryLogger.VisitQuery(query.Exclude, writer); --writer.Indent; }
public override Query Rewrite(IndexReader reader) { // ArrayList spanClauses = new ArrayList(); if (contents is TermQuery) { return contents; } // Build a sequence of Span clauses arranged in a SpanNear - child // clauses can be complex // Booleans e.g. nots and ors etc int numNegatives = 0; if (!(contents is BooleanQuery)) { throw new ArgumentException("Unknown query type \"" + contents.GetType().Name + "\" found in phrase query string \"" + phrasedQueryStringContents + "\""); } BooleanQuery bq = (BooleanQuery)contents; BooleanClause[] bclauses = bq.Clauses; SpanQuery[] allSpanClauses = new SpanQuery[bclauses.Length]; // For all clauses e.g. one* two~ for (int i = 0; i < bclauses.Length; i++) { // HashSet bclauseterms=new HashSet(); Query qc = bclauses[i].Query; // Rewrite this clause e.g one* becomes (one OR onerous) qc = qc.Rewrite(reader); if (bclauses[i].Occur_.Equals(BooleanClause.Occur.MUST_NOT)) { numNegatives++; } if (qc is BooleanQuery) { List<SpanQuery> sc = new List<SpanQuery>(); AddComplexPhraseClause(sc, (BooleanQuery)qc); if (sc.Count > 0) { allSpanClauses[i] = sc.ElementAt(0); } else { // Insert fake term e.g. phrase query was for "Fred Smithe*" and // there were no "Smithe*" terms - need to // prevent match on just "Fred". allSpanClauses[i] = new SpanTermQuery(new Term(field, "Dummy clause because no terms found - must match nothing")); } } else { if (qc is TermQuery) { TermQuery tq = (TermQuery)qc; allSpanClauses[i] = new SpanTermQuery(tq.Term); } else { throw new ArgumentException("Unknown query type \"" + qc.GetType().Name + "\" found in phrase query string \"" + phrasedQueryStringContents + "\""); } } } if (numNegatives == 0) { // The simple case - no negative elements in phrase return new SpanNearQuery(allSpanClauses, slopFactor, inOrder); } // Complex case - we have mixed positives and negatives in the // sequence. // Need to return a SpanNotQuery List<SpanQuery> positiveClauses = new List<SpanQuery>(); for (int j = 0; j < allSpanClauses.Length; j++) { if (!bclauses[j].Occur_.Equals(BooleanClause.Occur.MUST_NOT)) { positiveClauses.Add(allSpanClauses[j]); } } SpanQuery[] includeClauses = positiveClauses .ToArray(); SpanQuery include = null; if (includeClauses.Length == 1) { include = includeClauses[0]; // only one positive clause } else { // need to increase slop factor based on gaps introduced by // negatives include = new SpanNearQuery(includeClauses, slopFactor + numNegatives, inOrder); } // Use sequence of positive and negative values as the exclude. SpanNearQuery exclude = new SpanNearQuery(allSpanClauses, slopFactor, inOrder); SpanNotQuery snot = new SpanNotQuery(include, exclude); return snot; }
public virtual void TestSpanNot() { SpanTermQuery term1 = new SpanTermQuery(new Term("Field", "eight")); SpanTermQuery term2 = new SpanTermQuery(new Term("Field", "one")); SpanNearQuery near = new SpanNearQuery(new SpanQuery[]{term1, term2}, 4, true); SpanTermQuery term3 = new SpanTermQuery(new Term("Field", "forty")); SpanNotQuery query = new SpanNotQuery(near, term3); CheckHits(query, new int[]{801, 821, 831, 851, 861, 871, 881, 891}); Assert.IsTrue(searcher.Explain(query, 801).GetValue() > 0.0f); Assert.IsTrue(searcher.Explain(query, 891).GetValue() > 0.0f); }
public virtual void TestNpeInSpanNearInSpanFirstInSpanNot() { int n = 5; SpanTermQuery hun = new SpanTermQuery(new Term("field", "hundred")); SpanTermQuery term40 = new SpanTermQuery(new Term("field", "forty")); SpanTermQuery term40c = (SpanTermQuery) term40.Clone(); SpanFirstQuery include = new SpanFirstQuery(term40, n); SpanNearQuery near = new SpanNearQuery(new SpanQuery[]{hun, term40c}, n - 1, true); SpanFirstQuery exclude = new SpanFirstQuery(near, n - 1); SpanNotQuery q = new SpanNotQuery(include, exclude); CheckHits(q, new int[]{40, 41, 42, 43, 44, 45, 46, 47, 48, 49}); }
public AnonymousClassSpans(Lucene.Net.Index.IndexReader reader, SpanNotQuery enclosingInstance) { InitBlock(reader, enclosingInstance); }
private void AddComplexPhraseClause(List<SpanQuery> spanClauses, BooleanQuery qc) { List<SpanQuery> ors = new List<SpanQuery>(); List<SpanQuery> nots = new List<SpanQuery>(); BooleanClause[] bclauses = qc.Clauses; // For all clauses e.g. one* two~ for (int i = 0; i < bclauses.Length; i++) { Query childQuery = bclauses[i].Query; // select the list to which we will add these options List<SpanQuery> chosenList = ors; if (bclauses[i].Occur_ == BooleanClause.Occur.MUST_NOT) { chosenList = nots; } if (childQuery is TermQuery) { TermQuery tq = (TermQuery)childQuery; SpanTermQuery stq = new SpanTermQuery(tq.Term); stq.Boost = tq.Boost; chosenList.Add(stq); } else if (childQuery is BooleanQuery) { BooleanQuery cbq = (BooleanQuery)childQuery; AddComplexPhraseClause(chosenList, cbq); } else { // LUCENETODO alternatively could call extract terms here? throw new ArgumentException("Unknown query type:" + childQuery.GetType().Name); } } if (ors.Count == 0) { return; } SpanOrQuery soq = new SpanOrQuery(ors .ToArray()); if (nots.Count == 0) { spanClauses.Add(soq); } else { SpanOrQuery snqs = new SpanOrQuery(nots .ToArray()); SpanNotQuery snq = new SpanNotQuery(soq, snqs); spanClauses.Add(snq); } }
public SpansAnonymousInnerClassHelper(SpanNotQuery outerInstance, AtomicReaderContext context, Bits acceptDocs, IDictionary<Term, TermContext> termContexts) { this.OuterInstance = outerInstance; this.Context = context; this.AcceptDocs = acceptDocs; this.TermContexts = termContexts; includeSpans = outerInstance.include.GetSpans(context, acceptDocs, termContexts); moreInclude = true; excludeSpans = outerInstance.exclude.GetSpans(context, acceptDocs, termContexts); moreExclude = excludeSpans.Next(); }
public virtual Query VisitSpanNotQuery(SpanNotQuery spanNotq) { throw new NotImplementedException(); }
public override object Clone() { SpanNotQuery spanNotQuery = new SpanNotQuery((SpanQuery)include.Clone(), (SpanQuery)exclude.Clone(), Pre, Post); spanNotQuery.Boost = Boost; return spanNotQuery; }
public virtual void TestSpanNot() { SpanQuery[] clauses = new SpanQuery[2]; clauses[0] = new SpanTermQuery(new Term(PayloadHelper.FIELD, "one")); clauses[1] = new SpanTermQuery(new Term(PayloadHelper.FIELD, "three")); SpanQuery spq = new SpanNearQuery(clauses, 5, true); SpanNotQuery snq = new SpanNotQuery(spq, new SpanTermQuery(new Term(PayloadHelper.FIELD, "two"))); CheckSpans(snq.GetSpans(GetSpanNotSearcher().GetIndexReader()), 1, new int[]{2}); }
public override System.Object Clone() { SpanNotQuery spanNotQuery = new SpanNotQuery((SpanQuery) include.Clone(), (SpanQuery) exclude.Clone()); spanNotQuery.SetBoost(GetBoost()); return spanNotQuery; }
public virtual void TestNoSuchMultiTermsInNotNear() { //test to make sure non existent multiterms aren't throwing non-matching field exceptions FuzzyQuery fuzzyNoSuch = new FuzzyQuery(new Term("field", "noSuch"), 1, 0, 1, false); SpanQuery spanNoSuch = new SpanMultiTermQueryWrapper<MultiTermQuery>(fuzzyNoSuch); SpanQuery term = new SpanTermQuery(new Term("field", "brown")); SpanNotQuery notNear = new SpanNotQuery(term, spanNoSuch, 0, 0); Assert.AreEqual(1, Searcher.Search(notNear, 10).TotalHits); //flip notNear = new SpanNotQuery(spanNoSuch, term, 0, 0); Assert.AreEqual(0, Searcher.Search(notNear, 10).TotalHits); //both noSuch notNear = new SpanNotQuery(spanNoSuch, spanNoSuch, 0, 0); Assert.AreEqual(0, Searcher.Search(notNear, 10).TotalHits); WildcardQuery wcNoSuch = new WildcardQuery(new Term("field", "noSuch*")); SpanQuery spanWCNoSuch = new SpanMultiTermQueryWrapper<MultiTermQuery>(wcNoSuch); notNear = new SpanNotQuery(term, spanWCNoSuch, 0, 0); Assert.AreEqual(1, Searcher.Search(notNear, 10).TotalHits); RegexpQuery rgxNoSuch = new RegexpQuery(new Term("field", "noSuch")); SpanQuery spanRgxNoSuch = new SpanMultiTermQueryWrapper<MultiTermQuery>(rgxNoSuch); notNear = new SpanNotQuery(term, spanRgxNoSuch, 1, 1); Assert.AreEqual(1, Searcher.Search(notNear, 10).TotalHits); PrefixQuery prfxNoSuch = new PrefixQuery(new Term("field", "noSuch")); SpanQuery spanPrfxNoSuch = new SpanMultiTermQueryWrapper<MultiTermQuery>(prfxNoSuch); notNear = new SpanNotQuery(term, spanPrfxNoSuch, 1, 1); Assert.AreEqual(1, Searcher.Search(notNear, 10).TotalHits); }
private int SpanCount(string include, string exclude, int pre, int post) { SpanTermQuery iq = new SpanTermQuery(new Term(field, include)); SpanTermQuery eq = new SpanTermQuery(new Term(field, exclude)); SpanNotQuery snq = new SpanNotQuery(iq, eq, pre, post); Spans spans = MultiSpansWrapper.Wrap(Searcher.TopReaderContext, snq); int i = 0; while (spans.Next()) { i++; } return i; }
public virtual void TestSpanNotWindowTwoBefore() { SpanTermQuery term1 = new SpanTermQuery(new Term("field", "eight")); SpanTermQuery term2 = new SpanTermQuery(new Term("field", "forty")); SpanNearQuery near = new SpanNearQuery(new SpanQuery[] { term1, term2 }, 4, true); SpanTermQuery term3 = new SpanTermQuery(new Term("field", "one")); SpanNotQuery query = new SpanNotQuery(near, term3, 2, 0); CheckHits(query, new int[] { 840, 841, 842, 843, 844, 845, 846, 847, 848, 849 }); Assert.IsTrue(Searcher.Explain(query, 840).Value > 0.0f); Assert.IsTrue(Searcher.Explain(query, 849).Value > 0.0f); }
public virtual void TestNpeInSpanNearInSpanFirstInSpanNot() { int n = 5; SpanTermQuery hun = new SpanTermQuery(new Term("field", "hundred")); SpanTermQuery term40 = new SpanTermQuery(new Term("field", "forty")); SpanTermQuery term40c = (SpanTermQuery)term40.Clone(); SpanFirstQuery include = new SpanFirstQuery(term40, n); SpanNearQuery near = new SpanNearQuery(new SpanQuery[] { hun, term40c }, n - 1, true); SpanFirstQuery exclude = new SpanFirstQuery(near, n - 1); SpanNotQuery q = new SpanNotQuery(include, exclude); CheckHits(q, new int[] { 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1140, 1141, 1142, 1143, 1144, 1145, 1146, 1147, 1148, 1149, 1240, 1241, 1242, 1243, 1244, 1245, 1246, 1247, 1248, 1249, 1340, 1341, 1342, 1343, 1344, 1345, 1346, 1347, 1348, 1349, 1440, 1441, 1442, 1443, 1444, 1445, 1446, 1447, 1448, 1449, 1540, 1541, 1542, 1543, 1544, 1545, 1546, 1547, 1548, 1549, 1640, 1641, 1642, 1643, 1644, 1645, 1646, 1647, 1648, 1649, 1740, 1741, 1742, 1743, 1744, 1745, 1746, 1747, 1748, 1749, 1840, 1841, 1842, 1843, 1844, 1845, 1846, 1847, 1848, 1849, 1940, 1941, 1942, 1943, 1944, 1945, 1946, 1947, 1948, 1949 }); }
public virtual void TestSpanWithMultipleNotMany() { SpanTermQuery term1 = new SpanTermQuery(new Term("field", "eight")); SpanTermQuery term2 = new SpanTermQuery(new Term("field", "one")); SpanNearQuery near = new SpanNearQuery(new SpanQuery[]{term1, term2}, 4, true); SpanTermQuery term3 = new SpanTermQuery(new Term("field", "forty")); SpanTermQuery term4 = new SpanTermQuery(new Term("field", "sixty")); SpanTermQuery term5 = new SpanTermQuery(new Term("field", "eighty")); SpanOrQuery or = new SpanOrQuery(new SpanQuery[]{term3, term4, term5}); SpanNotQuery query = new SpanNotQuery(near, or); CheckHits(query, new int[]{801, 821, 831, 851, 871, 891}); Assert.IsTrue(searcher.Explain(query, 801).GetValue() > 0.0f); Assert.IsTrue(searcher.Explain(query, 891).GetValue() > 0.0f); }