lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: svn commit: r407485 - in /lucene/java/trunk: CHANGES.txt src/java/org/apache/lucene/search/spans/SpanNotQuery.java src/test/org/apache/lucene/search/spans/TestBasics.java
Date Thu, 18 May 2006 10:10:37 GMT
Welcome Hoss!   I've just moderated in your commit messages such that  
future ones will go through unmoderated.  Glad to have you committing!

	Erik


On May 18, 2006, at 3:39 AM, hossman@apache.org wrote:

> Author: hossman
> Date: Thu May 18 00:39:23 2006
> New Revision: 407485
>
> URL: http://svn.apache.org/viewvc?rev=407485&view=rev
> Log:
> fix for LUCENE-352
>
> Modified:
>     lucene/java/trunk/CHANGES.txt
>     lucene/java/trunk/src/java/org/apache/lucene/search/spans/ 
> SpanNotQuery.java
>     lucene/java/trunk/src/test/org/apache/lucene/search/spans/ 
> TestBasics.java
>
> Modified: lucene/java/trunk/CHANGES.txt
> URL: http://svn.apache.org/viewvc/lucene/java/trunk/CHANGES.txt? 
> rev=407485&r1=407484&r2=407485&view=diff
> ====================================================================== 
> ========
> --- lucene/java/trunk/CHANGES.txt (original)
> +++ lucene/java/trunk/CHANGES.txt Thu May 18 00:39:23 2006
> @@ -54,6 +54,9 @@
>  10. LUCENE-512: Fixed ClassCastException in  
> ParallelReader.getTermFreqVectors
>      (frederic via Yonik)
>
> +11. LUCENE-352: Fixed bug in SpanNotQuery that manifested as
> +    NullPointerException when "exclude" query was not a  
> SpanTermQuery.
> +
>  1.9.1
>
>  Bug fixes
>
> Modified: lucene/java/trunk/src/java/org/apache/lucene/search/spans/ 
> SpanNotQuery.java
> URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/ 
> apache/lucene/search/spans/SpanNotQuery.java? 
> rev=407485&r1=407484&r2=407485&view=diff
> ====================================================================== 
> ========
> --- lucene/java/trunk/src/java/org/apache/lucene/search/spans/ 
> SpanNotQuery.java (original)
> +++ lucene/java/trunk/src/java/org/apache/lucene/search/spans/ 
> SpanNotQuery.java Thu May 18 00:39:23 2006
> @@ -74,7 +74,7 @@
>          private boolean moreInclude = true;
>
>          private Spans excludeSpans = exclude.getSpans(reader);
> -        private boolean moreExclude = true;
> +        private boolean moreExclude = excludeSpans.next();
>
>          public boolean next() throws IOException {
>            if (moreInclude)                        // move to next  
> include
>
> Modified: lucene/java/trunk/src/test/org/apache/lucene/search/spans/ 
> TestBasics.java
> URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/ 
> apache/lucene/search/spans/TestBasics.java? 
> rev=407485&r1=407484&r2=407485&view=diff
> ====================================================================== 
> ========
> --- lucene/java/trunk/src/test/org/apache/lucene/search/spans/ 
> TestBasics.java (original)
> +++ lucene/java/trunk/src/test/org/apache/lucene/search/spans/ 
> TestBasics.java Thu May 18 00:39:23 2006
> @@ -160,7 +160,81 @@
>      assertTrue(searcher.explain(query, 801).getValue() > 0.0f);
>      assertTrue(searcher.explain(query, 891).getValue() > 0.0f);
>    }
> +
> +  public void testSpanWithMultipleNotSingle() throws Exception {
> +    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(new SpanQuery[] {term3});
> +
> +    SpanNotQuery query = new SpanNotQuery(near, or);
> +
> +    checkHits(query, new int[]
> +      {801, 821, 831, 851, 861, 871, 881, 891});
> +
> +    assertTrue(searcher.explain(query, 801).getValue() > 0.0f);
> +    assertTrue(searcher.explain(query, 891).getValue() > 0.0f);
> +  }
> +
> +  public void testSpanWithMultipleNotMany() throws Exception {
> +    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});
> +
> +    assertTrue(searcher.explain(query, 801).getValue() > 0.0f);
> +    assertTrue(searcher.explain(query, 891).getValue() > 0.0f);
> +  }
> +
> +  public void testNpeInSpanNearWithSpanNot() throws Exception {
> +    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});
> +
> +    assertTrue(searcher.explain(query, 801).getValue() > 0.0f);
> +    assertTrue(searcher.explain(query, 891).getValue() > 0.0f);
> +  }
> +
> +
> +  public void testNpeInSpanNearInSpanFirstInSpanNot() throws  
> Exception {
> +    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 void testSpanFirst() throws Exception {
>      SpanTermQuery term1 = new SpanTermQuery(new Term("field",  
> "five"));
>      SpanFirstQuery query = new SpanFirstQuery(term1, 1);
>


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Mime
View raw message