[ 
http://issues.apache.org/jira/browse/LUCENE-446?page=comments#action_12358936 ] 

Yonik Seeley commented on LUCENE-446:
-------------------------------------

This newest version simplifies a lot of cruft from the previous version.

A FunctionQuery takes a ValueSource.
The ValueSource produces a DocValues object for a specific IndexReader (It's 
like a lucene scorer).
The ValueSource is also used as input to functions, which are ValueSources 
themselves.

So, you can do things (symbolically), like

int(fieldx)
float(fieldx)
ord(fieldx)
rord(fieldx)
linear(fieldx,1,2)
linear(rord(fieldx),1,2,3)
reciprocal(linear(fieldx,1,2),3,4,5)

A useful one for boosting more recent dates might be:
reciprocal(rord(mydatefield),1,1000,1000)

I'm not sure if this is the final form yet... perhaps the division between 
ValueSource and Query  could be erased such that every value source is a query 
already (so that you don't need to pass it to a FunctionQuery).

It would also be nice to freely mix a lucene Query and a ValueSource so that 
you could do something like:
product(luceneQuery, val(fieldx))
  or even
product(luceneQuery1, luceneQuery2)

Of course, I haven't done the "product" function yet... right now, the normal 
way tocombine with other queries to influence the score is to put it in a 
boolean query:
+other_lucene_query_clauses +function_query^.1
the score from the function query is added to the other query.


> FunctionQuery - score based on field value
> ------------------------------------------
>
>          Key: LUCENE-446
>          URL: http://issues.apache.org/jira/browse/LUCENE-446
>      Project: Lucene - Java
>         Type: New Feature
>   Components: Search
>     Versions: 1.9
>     Reporter: Yonik Seeley
>  Attachments: function.zip
>
> FunctionQuery can return a score based on a field's value or on it's ordinal 
> value.
> FunctionFactory subclasses define the details of the function.  There is 
> currently a LinearFloatFunction (a line specified by slope and intercept).
> Field values are typically obtained from FieldValueSourceFactory.  
> Implementations include FloatFieldSource, IntFieldSource, and OrdFieldSource.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to