On Thu, Jul 1, 2010 at 1:02 PM, Blargy <[email protected]> wrote:
> Can someone explain what the createWeight methods should do?
Its primary function is to add Searcher context to anything that needs
it (such as weighting a query).
If you're not dealing with relevancy-type queries, value sources
should just delegate to any sub-valuesources.
> And one someone mind explaining what the hashCode method is doing in this
> use case?
>
> public int hashCode() {
> int h = a.hashCode();
> h ^= (h << 13) | (h >>> 20);
> h += b.hashCode();
> h ^= (h << 23) | (h >>> 10);
> h += name().hashCode();
> return h;
> }
It's mixing hash codes from different components. The particular
shift numbers make the transform reversible (i.e. no
information/entropy is lost).
-Yonik
http://www.lucidimagination.com