lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yonik Seeley" <ysee...@gmail.com>
Subject Re: svn commit: r384072 - in /lucene/java/trunk: CHANGES.txt src/java/org/apache/lucene/search/FilteredQuery.java src/test/org/apache/lucene/search/TestFilteredQuery.java
Date Wed, 08 Mar 2006 14:07:00 GMT
Given that 2.0 will follow on the heels of 1.9, will we even make any
more patch releases for 1.9?

-Yonik

On 3/8/06, Erik Hatcher <erik@ehatchersolutions.com> wrote:
> Should we keep this solely on the trunk or is there interest in me
> merging this into a 1.9 version as well?
>
>         Erik
>
>
> On Mar 7, 2006, at 7:59 PM, ehatcher@apache.org wrote:
>
> > Author: ehatcher
> > Date: Tue Mar  7 16:59:28 2006
> > New Revision: 384072
> >
> > URL: http://svn.apache.org/viewcvs?rev=384072&view=rev
> > Log:
> > Part of LUCENE-330: fixing FilteredQuery when nested within
> > BooleanQuery
> >
> > Modified:
> >     lucene/java/trunk/CHANGES.txt
> >     lucene/java/trunk/src/java/org/apache/lucene/search/
> > FilteredQuery.java
> >     lucene/java/trunk/src/test/org/apache/lucene/search/
> > TestFilteredQuery.java
> >
> > Modified: lucene/java/trunk/CHANGES.txt
> > URL: http://svn.apache.org/viewcvs/lucene/java/trunk/CHANGES.txt?
> > rev=384072&r1=384071&r2=384072&view=diff
> > ======================================================================
> > ========
> > --- lucene/java/trunk/CHANGES.txt (original)
> > +++ lucene/java/trunk/CHANGES.txt Tue Mar  7 16:59:28 2006
> > @@ -2,6 +2,13 @@
> >
> >  $Id$
> >
> > +2.0 RC1
> > +
> > +Bug fixes
> > +
> > + 1. LUCENE-330: Fix issue of FilteredQuery not working properly
> > within
> > +    BooleanQuery.  (Paul Elschot via Erik Hatcher)
> > +
> >  1.9.1
> >
> >  Bug fixes
> >
> > Modified: lucene/java/trunk/src/java/org/apache/lucene/search/
> > FilteredQuery.java
> > URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/java/org/
> > apache/lucene/search/FilteredQuery.java?
> > rev=384072&r1=384071&r2=384072&view=diff
> > ======================================================================
> > ========
> > --- lucene/java/trunk/src/java/org/apache/lucene/search/
> > FilteredQuery.java (original)
> > +++ lucene/java/trunk/src/java/org/apache/lucene/search/
> > FilteredQuery.java Tue Mar  7 16:59:28 2006
> > @@ -1,7 +1,7 @@
> >  package org.apache.lucene.search;
> >
> >  /**
> > - * Copyright 2004 The Apache Software Foundation
> > + * Copyright 2004,2006 The Apache Software Foundation
> >   *
> >   * Licensed under the Apache License, Version 2.0 (the "License");
> >   * you may not use this file except in compliance with the License.
> > @@ -75,22 +75,42 @@
> >        // return this query
> >        public Query getQuery() { return FilteredQuery.this; }
> >
> > -      // return a scorer that overrides the enclosed query's score if
> > -      // the given hit has been filtered out.
> > -      public Scorer scorer (IndexReader indexReader) throws
> > IOException {
> > +      // return a filtering scorer
> > +       public Scorer scorer (IndexReader indexReader) throws
> > IOException {
> >          final Scorer scorer = weight.scorer (indexReader);
> >          final BitSet bitset = filter.bits (indexReader);
> >          return new Scorer (similarity) {
> >
> > -          // pass these methods through to the enclosed scorer
> > -          public boolean next() throws IOException { return
> > scorer.next(); }
> > +          public boolean next() throws IOException {
> > +            do {
> > +              if (! scorer.next()) {
> > +                return false;
> > +              }
> > +            } while (! bitset.get(scorer.doc()));
> > +            /* When skipTo() is allowed on scorer it should be
> > used here
> > +             * in combination with bitset.nextSetBit(...)
> > +             * See the while loop in skipTo() below.
> > +             */
> > +            return true;
> > +          }
> >            public int doc() { return scorer.doc(); }
> > -          public boolean skipTo (int i) throws IOException
> > { return scorer.skipTo(i); }
> >
> > -          // if the document has been filtered out, set score to 0.0
> > -          public float score() throws IOException {
> > -            return (bitset.get(scorer.doc())) ? scorer.score() :
> > 0.0f;
> > -          }
> > +          public boolean skipTo(int i) throws IOException {
> > +            if (! scorer.skipTo(i)) {
> > +              return false;
> > +            }
> > +            while (! bitset.get(scorer.doc())) {
> > +              int nextFiltered = bitset.nextSetBit(scorer.doc() + 1);
> > +              if (nextFiltered == -1) {
> > +                return false;
> > +              } else if (! scorer.skipTo(nextFiltered)) {
> > +                return false;
> > +              }
> > +            }
> > +            return true;
> > +           }
> > +
> > +          public float score() throws IOException { return
> > scorer.score(); }
> >
> >            // add an explanation about whether the document was
> > filtered
> >            public Explanation explain (int i) throws IOException {
> >
> > Modified: lucene/java/trunk/src/test/org/apache/lucene/search/
> > TestFilteredQuery.java
> > URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/test/org/
> > apache/lucene/search/TestFilteredQuery.java?
> > rev=384072&r1=384071&r2=384072&view=diff
> > ======================================================================
> > ========
> > --- lucene/java/trunk/src/test/org/apache/lucene/search/
> > TestFilteredQuery.java (original)
> > +++ lucene/java/trunk/src/test/org/apache/lucene/search/
> > TestFilteredQuery.java Tue Mar  7 16:59:28 2006
> > @@ -126,7 +126,6 @@
> >      assertEquals(2, hits.length());
> >    }
> >
> > -
> >    public void testBoolean() throws Exception {
> >      BooleanQuery bq = new BooleanQuery();
> >      Query query = new FilteredQuery(new MatchAllDocsQuery(),
> > @@ -136,8 +135,6 @@
> >          new SingleDocTestFilter(1));
> >      bq.add(query, BooleanClause.Occur.MUST);
> >      Hits hits = searcher.search(bq);
> > -    System.out.println(hits.id(0));
> > -    System.out.println(hits.id(1));
> >      assertEquals(0, hits.length());
> >    }
> >  }
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org
>
>

---------------------------------------------------------------------
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