Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Lucene: Java-Dev

Re: svn commit: r882977 - in /lucene/java/trunk: CHANGES.txt src/java/org/apache/lucene/search/NumericRangeQuery.java

 

 

Lucene java-dev RSS feed   Index | Next | Previous | View Threaded


simon.willnauer at googlemail

Nov 21, 2009, 11:59 AM

Post #1 of 2 (174 views)
Permalink
Re: svn commit: r882977 - in /lucene/java/trunk: CHANGES.txt src/java/org/apache/lucene/search/NumericRangeQuery.java

Is the trunk open for 3.1 already?

simon

On Sat, Nov 21, 2009 at 8:49 PM, <uschindler [at] apache> wrote:
> Author: uschindler
> Date: Sat Nov 21 19:49:54 2009
> New Revision: 882977
>
> URL: http://svn.apache.org/viewvc?rev=882977&view=rev
> Log:
> LUCENE-2087: Remove recursion in NumericRangeTermEnum
>
> Modified:
>    lucene/java/trunk/CHANGES.txt
>    lucene/java/trunk/src/java/org/apache/lucene/search/NumericRangeQuery.java
>
> Modified: lucene/java/trunk/CHANGES.txt
> URL: http://svn.apache.org/viewvc/lucene/java/trunk/CHANGES.txt?rev=882977&r1=882976&r2=882977&view=diff
> ==============================================================================
> --- lucene/java/trunk/CHANGES.txt (original)
> +++ lucene/java/trunk/CHANGES.txt Sat Nov 21 19:49:54 2009
> @@ -18,7 +18,10 @@
>  Optimizations
>
>  * LUCENE-2086: When resolving deleted terms, do so in term sort order
> -  for better performance (Bogdan Ghidireac via Mike McCandless)
> +  for better performance. (Bogdan Ghidireac via Mike McCandless)
> +
> +* LUCENE-2087: Remove recursion in NumericRangeTermEnum.
> +  (Uwe Schindler)
>
>  Build
>
>
> Modified: lucene/java/trunk/src/java/org/apache/lucene/search/NumericRangeQuery.java
> URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/NumericRangeQuery.java?rev=882977&r1=882976&r2=882977&view=diff
> ==============================================================================
> --- lucene/java/trunk/src/java/org/apache/lucene/search/NumericRangeQuery.java (original)
> +++ lucene/java/trunk/src/java/org/apache/lucene/search/NumericRangeQuery.java Sat Nov 21 19:49:54 2009
> @@ -27,6 +27,7 @@
>  import org.apache.lucene.util.StringHelper;
>  import org.apache.lucene.index.IndexReader;
>  import org.apache.lucene.index.Term;
> +import org.apache.lucene.index.TermEnum;
>
>  /**
>  * <p>A {@link Query} that matches numeric values within a
> @@ -486,6 +487,12 @@
>       throw new UnsupportedOperationException("not implemented");
>     }
>
> +    /** this is a dummy, it is not used by this class. */
> +    @Override
> +    protected void setEnum(TermEnum tenum) {
> +      throw new UnsupportedOperationException("not implemented");
> +    }
> +
>     /**
>      * Compares if current upper bound is reached,
>      * this also updates the term count for statistics.
> @@ -507,29 +514,35 @@
>         assert actualEnum != null;
>         if (actualEnum.next()) {
>           currentTerm = actualEnum.term();
> -          if (termCompare(currentTerm)) return true;
> +          if (termCompare(currentTerm))
> +            return true;
>         }
>       }
> +
>       // if all above fails, we go forward to the next enum,
>       // if one is available
>       currentTerm = null;
> -      if (rangeBounds.size() < 2) {
> -        assert rangeBounds.size() == 0;
> -        return false;
> -      }
> -      // close the current enum and read next bounds
> -      if (actualEnum != null) {
> -        actualEnum.close();
> -        actualEnum = null;
> +      while (rangeBounds.size() >= 2) {
> +        assert rangeBounds.size() % 2 == 0;
> +        // close the current enum and read next bounds
> +        if (actualEnum != null) {
> +          actualEnum.close();
> +          actualEnum = null;
> +        }
> +        final String lowerBound = rangeBounds.removeFirst();
> +        this.currentUpperBound = rangeBounds.removeFirst();
> +        // create a new enum
> +        actualEnum = reader.terms(termTemplate.createTerm(lowerBound));
> +        currentTerm = actualEnum.term();
> +        if (currentTerm != null && termCompare(currentTerm))
> +          return true;
> +        // clear the current term for next iteration
> +        currentTerm = null;
>       }
> -      final String lowerBound = rangeBounds.removeFirst();
> -      this.currentUpperBound = rangeBounds.removeFirst();
> -      // this call recursively uses next(), if no valid term in
> -      // next enum found.
> -      // if this behavior is changed/modified in the superclass,
> -      // this enum will not work anymore!
> -      setEnum(reader.terms(termTemplate.createTerm(lowerBound)));
> -      return (currentTerm != null);
> +
> +      // no more sub-range enums available
> +      assert rangeBounds.size() == 0 && currentTerm == null;
> +      return false;
>     }
>
>     /** Closes the enumeration to further activity, freeing resources.  */
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe [at] lucene
For additional commands, e-mail: java-dev-help [at] lucene


uwe at thetaphi

Nov 21, 2009, 12:02 PM

Post #2 of 2 (154 views)
Permalink
RE: svn commit: r882977 - in /lucene/java/trunk: CHANGES.txt src/java/org/apache/lucene/search/NumericRangeQuery.java [In reply to]

Yes since Tuesday.

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe [at] thetaphi

> -----Original Message-----
> From: Simon Willnauer [mailto:simon.willnauer [at] googlemail]
> Sent: Saturday, November 21, 2009 9:00 PM
> To: java-dev [at] lucene
> Subject: Re: svn commit: r882977 - in /lucene/java/trunk: CHANGES.txt
> src/java/org/apache/lucene/search/NumericRangeQuery.java
>
> Is the trunk open for 3.1 already?
>
> simon
>
> On Sat, Nov 21, 2009 at 8:49 PM, <uschindler [at] apache> wrote:
> > Author: uschindler
> > Date: Sat Nov 21 19:49:54 2009
> > New Revision: 882977
> >
> > URL: http://svn.apache.org/viewvc?rev=882977&view=rev
> > Log:
> > LUCENE-2087: Remove recursion in NumericRangeTermEnum
> >
> > Modified:
> >    lucene/java/trunk/CHANGES.txt
> >
>  lucene/java/trunk/src/java/org/apache/lucene/search/NumericRangeQuery.jav
> a
> >
> > Modified: lucene/java/trunk/CHANGES.txt
> > URL:
> http://svn.apache.org/viewvc/lucene/java/trunk/CHANGES.txt?rev=882977&r1=8
> 82976&r2=882977&view=diff
> >
> ==========================================================================
> ====
> > --- lucene/java/trunk/CHANGES.txt (original)
> > +++ lucene/java/trunk/CHANGES.txt Sat Nov 21 19:49:54 2009
> > @@ -18,7 +18,10 @@
> >  Optimizations
> >
> >  * LUCENE-2086: When resolving deleted terms, do so in term sort order
> > -  for better performance (Bogdan Ghidireac via Mike McCandless)
> > +  for better performance. (Bogdan Ghidireac via Mike McCandless)
> > +
> > +* LUCENE-2087: Remove recursion in NumericRangeTermEnum.
> > +  (Uwe Schindler)
> >
> >  Build
> >
> >
> > Modified:
> lucene/java/trunk/src/java/org/apache/lucene/search/NumericRangeQuery.java
> > URL:
> http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/
> search/NumericRangeQuery.java?rev=882977&r1=882976&r2=882977&view=diff
> >
> ==========================================================================
> ====
> > ---
> lucene/java/trunk/src/java/org/apache/lucene/search/NumericRangeQuery.java
> (original)
> > +++
> lucene/java/trunk/src/java/org/apache/lucene/search/NumericRangeQuery.java
> Sat Nov 21 19:49:54 2009
> > @@ -27,6 +27,7 @@
> >  import org.apache.lucene.util.StringHelper;
> >  import org.apache.lucene.index.IndexReader;
> >  import org.apache.lucene.index.Term;
> > +import org.apache.lucene.index.TermEnum;
> >
> >  /**
> >  * <p>A {@link Query} that matches numeric values within a
> > @@ -486,6 +487,12 @@
> >       throw new UnsupportedOperationException("not implemented");
> >     }
> >
> > +    /** this is a dummy, it is not used by this class. */
> > +    @Override
> > +    protected void setEnum(TermEnum tenum) {
> > +      throw new UnsupportedOperationException("not implemented");
> > +    }
> > +
> >     /**
> >      * Compares if current upper bound is reached,
> >      * this also updates the term count for statistics.
> > @@ -507,29 +514,35 @@
> >         assert actualEnum != null;
> >         if (actualEnum.next()) {
> >           currentTerm = actualEnum.term();
> > -          if (termCompare(currentTerm)) return true;
> > +          if (termCompare(currentTerm))
> > +            return true;
> >         }
> >       }
> > +
> >       // if all above fails, we go forward to the next enum,
> >       // if one is available
> >       currentTerm = null;
> > -      if (rangeBounds.size() < 2) {
> > -        assert rangeBounds.size() == 0;
> > -        return false;
> > -      }
> > -      // close the current enum and read next bounds
> > -      if (actualEnum != null) {
> > -        actualEnum.close();
> > -        actualEnum = null;
> > +      while (rangeBounds.size() >= 2) {
> > +        assert rangeBounds.size() % 2 == 0;
> > +        // close the current enum and read next bounds
> > +        if (actualEnum != null) {
> > +          actualEnum.close();
> > +          actualEnum = null;
> > +        }
> > +        final String lowerBound = rangeBounds.removeFirst();
> > +        this.currentUpperBound = rangeBounds.removeFirst();
> > +        // create a new enum
> > +        actualEnum = reader.terms(termTemplate.createTerm(lowerBound));
> > +        currentTerm = actualEnum.term();
> > +        if (currentTerm != null && termCompare(currentTerm))
> > +          return true;
> > +        // clear the current term for next iteration
> > +        currentTerm = null;
> >       }
> > -      final String lowerBound = rangeBounds.removeFirst();
> > -      this.currentUpperBound = rangeBounds.removeFirst();
> > -      // this call recursively uses next(), if no valid term in
> > -      // next enum found.
> > -      // if this behavior is changed/modified in the superclass,
> > -      // this enum will not work anymore!
> > -      setEnum(reader.terms(termTemplate.createTerm(lowerBound)));
> > -      return (currentTerm != null);
> > +
> > +      // no more sub-range enums available
> > +      assert rangeBounds.size() == 0 && currentTerm == null;
> > +      return false;
> >     }
> >
> >     /** Closes the enumeration to further activity, freeing resources.
>  */
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe [at] lucene
> For additional commands, e-mail: java-dev-help [at] lucene



---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe [at] lucene
For additional commands, e-mail: java-dev-help [at] lucene

Lucene java-dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.