Mailing List Archive

Integer.MAX_VALUE sentinel never checked?
Plucene is nearly finished, and is busy being unit-tested to death. In the
process of doing this, we found that some of our phrase queries were returning
more results than we expected. This is because when PhrasePositions falls off
the end of the iterator, it returns a sentinel value:

if (!tp.next()) {
tp.close(); // close stream
doc = Integer.MAX_VALUE; // sentinel value
return;
}

However, I can't see anything else that checks for that sentinel:

% grep MAX_ *.java
DateFilter.java: String end = DateField.MAX_DATE_STRING();
PhrasePositions.java: doc = Integer.MAX_VALUE; // sentinel value
TermScorer.java: doc = Integer.MAX_VALUE; // set to sentinel value
TermScorer.java: doc = Integer.MAX_VALUE; // set to sentinel value

so a very big document ID is finding its way into the result set. Is
this the desired behaviour?

--
"The elder gods went to Suggoth and all I got was this lousy T-shirt."

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
Re: Integer.MAX_VALUE sentinel never checked? [ In reply to ]
Doug Cutting:
> I don't think this value actually find its way into the results. Rather
> it causes PhraseScorer.score() to exit, as this value is always greater
> than the value of 'end' passed into that method.

Yep, I screwed up; sorry. Working nicely now.

--
In related wibbling, I can see an opening for the four lusers of the
Apocalypse... "I didn't change anything", "My e-mail doesn't work",
"I can't print" and "Is the network broken?".
- Paul Mc Auley

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
Re: Integer.MAX_VALUE sentinel never checked? [ In reply to ]
I don't think this value actually find its way into the results. Rather
it causes PhraseScorer.score() to exit, as this value is always greater
than the value of 'end' passed into that method.

Doug

Simon Cozens wrote:

> Plucene is nearly finished, and is busy being unit-tested to death. In the
> process of doing this, we found that some of our phrase queries were returning
> more results than we expected. This is because when PhrasePositions falls off
> the end of the iterator, it returns a sentinel value:
>
> if (!tp.next()) {
> tp.close(); // close stream
> doc = Integer.MAX_VALUE; // sentinel value
> return;
> }
>
> However, I can't see anything else that checks for that sentinel:
>
> % grep MAX_ *.java
> DateFilter.java: String end = DateField.MAX_DATE_STRING();
> PhrasePositions.java: doc = Integer.MAX_VALUE; // sentinel value
> TermScorer.java: doc = Integer.MAX_VALUE; // set to sentinel value
> TermScorer.java: doc = Integer.MAX_VALUE; // set to sentinel value
>
> so a very big document ID is finding its way into the result set. Is
> this the desired behaviour?
>


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
RE: Re: Integer.MAX_VALUE sentinel never checked? [ In reply to ]
On 3203/12/01 19:23:01 Doug Cutting wrote:
> I don't think this value actually find its way into the results. Rather
> it causes PhraseScorer.score() to exit, as this value is always greater
> than the value of 'end' passed into that method.
>
> Doug
>
> Simon Cozens wrote:
>
> > Plucene is nearly finished, and is busy being unit-tested to death. In
the
> > process of doing this, we found that some of our phrase queries were
returning
> > more results than we expected. This is because when PhrasePositions
falls off
> > the end of the iterator, it returns a sentinel value:
> >
> > if (!tp.next()) {
> > tp.close(); // close stream
> > doc = Integer.MAX_VALUE; // sentinel value
> > return;
> > }
> >
> > However, I can't see anything else that checks for that sentinel:
> >
> > % grep MAX_ *.java
> > DateFilter.java: String end = DateField.MAX_DATE_STRING();
> > PhrasePositions.java: doc =
Integer.MAX_VALUE; // sentinel value
> > TermScorer.java: doc = Integer.MAX_VALUE; //
set to sentinel value
> > TermScorer.java: doc = Integer.MAX_VALUE; //
set to sentinel value
> >
> > so a very big document ID is finding its way into the result set. Is
> > this the desired behaviour?
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
>
> Hi
RE: Re: Integer.MAX_VALUE sentinel never checked? [ In reply to ]
On 3203/12/01 19:23:01 Doug Cutting wrote:
> I don't think this value actually find its way into the results. Rather
> it causes PhraseScorer.score() to exit, as this value is always greater
> than the value of 'end' passed into that method.
>
> Doug
>
> Simon Cozens wrote:
>
> > Plucene is nearly finished, and is busy being unit-tested to death. In
the
> > process of doing this, we found that some of our phrase queries were
returning
> > more results than we expected. This is because when PhrasePositions
falls off
> > the end of the iterator, it returns a sentinel value:
> >
> > if (!tp.next()) {
> > tp.close(); // close stream
> > doc = Integer.MAX_VALUE; // sentinel value
> > return;
> > }
> >
> > However, I can't see anything else that checks for that sentinel:
> >
> > % grep MAX_ *.java
> > DateFilter.java: String end = DateField.MAX_DATE_STRING();
> > PhrasePositions.java: doc =
Integer.MAX_VALUE; // sentinel value
> > TermScorer.java: doc = Integer.MAX_VALUE; //
set to sentinel value
> > TermScorer.java: doc = Integer.MAX_VALUE; //
set to sentinel value
> >
> > so a very big document ID is finding its way into the result set. Is
> > this the desired behaviour?
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
>
>