lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yonik Seeley <yo...@lucidimagination.com>
Subject Re: ValueSource/Function questions
Date Thu, 01 Jul 2010 17:39:27 GMT
On Thu, Jul 1, 2010 at 1:02 PM, Blargy <zmanods@hotmail.com> 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

Mime
View raw message