Mailing List Archive

RE: can some access modifiers in org.apache.lucene.search be cha nged/"opened up"
> From: Spencer, Dave [mailto:dave@lumos.com]
>
> Proposed solution is to change a couple of decls in Scorer and Query:
>
> Scorer.java
> make score() public
>
> Query.java
> make all methods public or protected (normalize,
> sumOfSquaredWeights,prepare)

I'm a little hesitant. These are internal APIs that it's nice to be able to
change without worrying about breaking other people's code. Exposing them
is also likely to confuse most users, who should never need to call these.

So if we expose them we must first add Javadoc comments. This should make
it clear that these methods are not for general consumption. We should use
protected whereever possible. (I use package private a lot in Lucene just
to keep the Javadoc API clean.)

Scorer.score() is a bit of an odd API. It is called with increasing maxDoc
values and is expected to only score documents from the last maxDoc passed
(or zero initially) to the current maxDoc. This is required for the
algorithm that BooleanQuery uses to optimize OR.

Someday (soon, hopefully) I'd like to write a new scorer that optimizes AND
much better--when all the terms are required you can skip through TermDocs.
I haven't yet worked out how the two algorithms will play together and what
the impact will be on the Scorer API, but it will probably change.

Doug

--
To unsubscribe, e-mail: <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-dev-help@jakarta.apache.org>