RE: svn commit: r888397 - in /lucene/java/branches/flex_1458: ./ contrib/regex/src/test/org/apache/lucene/search/regex/ src/java/org/apache/lucene/index/

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

RE: svn commit: r888397 - in /lucene/java/branches/flex_1458: ./ contrib/regex/src/test/org/apache/lucene/search/regex/ src/java/org/apache/lucene/index/

Uwe Schindler
Here the test is ok, because in flex the enum is unitialized before fisrt
next() call.

But even in flex the backwards API should be tested, so the getEnum() test
from trunk should be here, too.

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


> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]]
> Sent: Tuesday, December 08, 2009 2:47 PM
> To: [hidden email]
> Subject: svn commit: r888397 - in /lucene/java/branches/flex_1458: ./
> contrib/regex/src/test/org/apache/lucene/search/regex/
> src/java/org/apache/lucene/index/
>
> Author: mikemccand
> Date: Tue Dec  8 13:47:09 2009
> New Revision: 888397
>
> URL: http://svn.apache.org/viewvc?rev=888397&view=rev
> Log:
> LUCENE-2136 (on flex branch): optimization: if Multi/DirectoryReader only
> has a single reader, delegate enums to it
>
> Modified:
>     lucene/java/branches/flex_1458/CHANGES.txt
>
> lucene/java/branches/flex_1458/contrib/regex/src/test/org/apache/lucene/se
> arch/regex/TestRegexQuery.java
>
> lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DirectoryR
> eader.java
>
> lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/MultiReade
> r.java
>
> lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/ParallelRe
> ader.java
>
> Modified: lucene/java/branches/flex_1458/CHANGES.txt
> URL:
> http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/CHANGES.txt?re
> v=888397&r1=888396&r2=888397&view=diff
> ==========================================================================
> ====
> --- lucene/java/branches/flex_1458/CHANGES.txt (original)
> +++ lucene/java/branches/flex_1458/CHANGES.txt Tue Dec  8 13:47:09 2009
> @@ -50,6 +50,11 @@
>    lots of seeking (Mike McCandless, Uwe Schindler, Robert Muir, Yonik
>    Seeley)
>
> +* LUCENE-2136: If the multi reader (DirectoryReader or MultiReader)
> +  only has a single sub-reader, delegate all enum requests to it.
> +  This avoid the overhead of using a PQ unecessarily.  (Mike
> +  McCandless)
> +
>  Build
>
>  Test Cases
>
> Modified:
> lucene/java/branches/flex_1458/contrib/regex/src/test/org/apache/lucene/se
> arch/regex/TestRegexQuery.java
> URL:
> http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/regex/
> src/test/org/apache/lucene/search/regex/TestRegexQuery.java?rev=888397&r1=
> 888396&r2=888397&view=diff
> ==========================================================================
> ====
> ---
> lucene/java/branches/flex_1458/contrib/regex/src/test/org/apache/lucene/se
> arch/regex/TestRegexQuery.java (original)
> +++
> lucene/java/branches/flex_1458/contrib/regex/src/test/org/apache/lucene/se
> arch/regex/TestRegexQuery.java Tue Dec  8 13:47:09 2009
> @@ -83,7 +83,6 @@
>    public void testMatchAll() throws Exception {
>      RegexTermsEnum terms = (RegexTermsEnum) new RegexQuery(new Term(FN,
> "jum.")).getTermsEnum(searcher.getIndexReader());
>      // no term should match
> -    assertNull(terms.term());
>      assertNull(terms.next());
>    }
>
>
> Modified:
> lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DirectoryR
> eader.java
> URL:
> http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/a
> pache/lucene/index/DirectoryReader.java?rev=888397&r1=888396&r2=888397&vie
> w=diff
> ==========================================================================
> ====
> ---
> lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DirectoryR
> eader.java (original)
> +++
> lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DirectoryR
> eader.java Tue Dec  8 13:47:09 2009
> @@ -763,10 +763,15 @@
>      ensureOpen();
>      return new MultiTermDocs(this, subReaders, starts);
>    }
> -
> +
>    @Override
>    public Fields fields() throws IOException {
> -    return fields;
> +    if (subReaders.length == 1) {
> +      // Optimize the single reader case
> +      return subReaders[0].fields();
> +    } else {
> +      return fields;
> +    }
>    }
>
>    @Override
>
> Modified:
> lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/MultiReade
> r.java
> URL:
> http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/a
> pache/lucene/index/MultiReader.java?rev=888397&r1=888396&r2=888397&view=di
> ff
> ==========================================================================
> ====
> ---
> lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/MultiReade
> r.java (original)
> +++
> lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/MultiReade
> r.java Tue Dec  8 13:47:09 2009
> @@ -103,7 +103,12 @@
>
>    @Override
>    public Fields fields() throws IOException {
> -    return fields;
> +    if (subReaders.length == 1) {
> +      // Optimize the single reader case
> +      return subReaders[0].fields();
> +    } else {
> +      return fields;
> +    }
>    }
>
>    /**
>
> Modified:
> lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/ParallelRe
> ader.java
> URL:
> http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/a
> pache/lucene/index/ParallelReader.java?rev=888397&r1=888396&r2=888397&view
> =diff
> ==========================================================================
> ====
> ---
> lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/ParallelRe
> ader.java (original)
> +++
> lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/ParallelRe
> ader.java Tue Dec  8 13:47:09 2009
> @@ -151,7 +151,12 @@
>      @Override
>      public TermsEnum terms() throws IOException {
>        assert currentReader != null;
> -      return currentReader.fields().terms(currentField).iterator();
> +      Terms terms = currentReader.fields().terms(currentField);
> +      if (terms != null) {
> +        return terms.iterator();
> +      } else {
> +        return null;
> +      }
>      }
>    }
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]