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 Slavko Bodvanski <bo...@gmail.com> on 2015/06/08 14:50:15 UTC

Score function

Hello,

Solr schema that I use defines products on a document level where product
has number of predefined and custom fields. For instance, there are fields
like id of a catalog to which product belongs, title, description, price,
category etc.

I'd like to use scale function
(org.apache.lucene.queries.function.valuesource.ScaleFloatFunction.java)
and  inject it into bf parameter in order to scale numeric fields values
down to some base value range like 0..1. On the top of that, some boost
factor would be applied to affect scoring.

By looking at the source code, I've learned that current scale function
implementation traverses all of the field (function) values to obtain the
min and max values, so it can calculate the correct scale. This doesn't
work for me because I need to get the correct scale based on the numeric
field values of documents that match the main query criteria (q and fq
clauses).  For example, if catalog id and category fields restrictions are
used (q=catalog_id:100 AND category:shoes), in order to calculate min and
max,  scale function for price field should take into account only price
values which belong to documents from catalog of id 100 and are under shoes
category.

Is that possible to do out of the box?
is there a way to obtain reference to a document id set (set filtered by
the main query criteria) and use it within the custom function context?


Any kind of help is appreciated!

Thanks,
Slavko