You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Blargy <zm...@hotmail.com> on 2010/07/01 19:02:11 UTC
ValueSource/Function questions
Can someone explain what the createWeight methods should do?
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;
}
--
View this message in context: http://lucene.472066.n3.nabble.com/ValueSource-Function-questions-tp936672p936672.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: ValueSource/Function questions
Posted by Yonik Seeley <yo...@lucidimagination.com>.
On Thu, Jul 1, 2010 at 1:02 PM, Blargy <zm...@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