I see where I was confused - I was looking at the javadoc for TermsEnum,
which says you must call next or seek before getting the term - but I
was more confused than straightened out when I saw FilteredTermsEnum
said the enum must already be positioned at the first term - it didn't
dawn on me that they acted different in that regard - thats why I put
the nocommit - was a bit confused. Looking at the code, it makes sense
now though.

I do agree that its a bit confusing now that you have to call .empty
first now. Thats what led me down the path of trying .next != null -
didn't even occur to me there was a .empty. Knew something was screwy
though, even with the test passing.
> --- 
> lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java
>  (original)
> +++ 
> lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java
>  Wed Dec  2 23:27:49 2009
> @@ -443,9 +443,8 @@
>      NumericRangeQuery<Integer> q = NumericRangeQuery.newIntRange("field4", 4,
>          lower, upper, true, true);
>      FilteredTermsEnum termEnum = q.getTermsEnum(searcher.getIndexReader());
> -    //nocommit: double check this merge 'fix'
>      int count = 0;
> -    if (termEnum.next() != null) {
> +    if (!termEnum.empty()) {
>        do {
>          final TermRef t = termEnum.term();
>          if (t != null) {
> @@ -457,7 +456,7 @@
>            break;
>        } while (termEnum.next() != null);
>      }
> -    assertFalse(termEnum.next() != null);
> +    assertNotNull(termEnum.next());
>      System.out.println("TermEnum on 'field4' for range [" + lower + "," + 
> upper
>          + "] contained " + count + " terms.");
>   


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

Reply via email to