You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by "Sokolov, Michael" <ms...@gmail.com> on 2017/10/10 19:39:48 UTC

FunctionValues vs DoubleValuesSource

Hi, I'm trying to implement a complex set of values computed according 
to some externally-driven specification, so I am looking at these APIs. 
My question is whether there is any way to mix them. I have implemented 
some DoubleValuesSources and now I want combine them using sum, max, 
etc. I noticed these handy classes over in 
o.a.l.queries.function.valuesource, but they seem to be of a different 
flavor than the DVS API is designed for. EG DVS is kind of an iterative 
API while the functions appear to be random access (you pass them a 
docid). I could code up my own DVS for functions like max, sum and so 
on, but I wonder if there is some kind of adapter, or at least a 
reasonable strategy that would let one mix these apis?

-Mike


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: FunctionValues vs DoubleValuesSource

Posted by Mike Sokolov <ms...@gmail.com>.
Oh thanks Alan that's a good suggestion, but I already wrote max and sum double values sources since it was easy enough. If you think that's a good approach I could post a patch.

On October 13, 2017 3:57:30 AM EDT, Alan Woodward <al...@flax.co.uk> wrote:
>Hi,
>
>Yes, moving stuff over to DoubleValuesSource is only half done at the
>moment, unfortunately!
>
>Can you use the expressions module to do what you want?  The
>SimpleBindings class allows you to map arbitrary DoubleValuesSource
>objects to specific names, and then you can combine them using
>javascript functions.
>
>Alan Woodward
>www.flax.co.uk
>
>
>> On 12 Oct 2017, at 23:25, Michael McCandless
><lu...@mikemccandless.com> wrote:
>> 
>> Hi Mike,
>> 
>> It looks like FunctionValues is a very old API used by many function
>> queries, while DoubleValuesSource is relatively new (introduced in
>> https://issues.apache.org/jira/browse/LUCENE-5325).
>> 
>> This comment (
>>
>https://issues.apache.org/jira/browse/LUCENE-5325?focusedCommentId=15235324&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15235324)
>> on the issue seems to refer to wrapper classes to convert between the
>old
>> and new APIs?
>> 
>> I admit the situation is rather confusing; but we've been gradually
>working
>> on cutting over modules to the new API.  Patches welcome!
>> 
>> Mike McCandless
>> 
>> http://blog.mikemccandless.com
>> 
>> On Tue, Oct 10, 2017 at 3:39 PM, Sokolov, Michael
><ms...@gmail.com>
>> wrote:
>> 
>>> Hi, I'm trying to implement a complex set of values computed
>according to
>>> some externally-driven specification, so I am looking at these APIs.
>My
>>> question is whether there is any way to mix them. I have implemented
>some
>>> DoubleValuesSources and now I want combine them using sum, max, etc.
>I
>>> noticed these handy classes over in
>o.a.l.queries.function.valuesource,
>>> but they seem to be of a different flavor than the DVS API is
>designed for.
>>> EG DVS is kind of an iterative API while the functions appear to be
>random
>>> access (you pass them a docid). I could code up my own DVS for
>functions
>>> like max, sum and so on, but I wonder if there is some kind of
>adapter, or
>>> at least a reasonable strategy that would let one mix these apis?
>>> 
>>> -Mike
>>> 
>>> 
>>>
>---------------------------------------------------------------------
>>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>> 
>>> 

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

Re: FunctionValues vs DoubleValuesSource

Posted by Alan Woodward <al...@flax.co.uk>.
Hi,

Yes, moving stuff over to DoubleValuesSource is only half done at the moment, unfortunately!

Can you use the expressions module to do what you want?  The SimpleBindings class allows you to map arbitrary DoubleValuesSource objects to specific names, and then you can combine them using javascript functions.

Alan Woodward
www.flax.co.uk


> On 12 Oct 2017, at 23:25, Michael McCandless <lu...@mikemccandless.com> wrote:
> 
> Hi Mike,
> 
> It looks like FunctionValues is a very old API used by many function
> queries, while DoubleValuesSource is relatively new (introduced in
> https://issues.apache.org/jira/browse/LUCENE-5325).
> 
> This comment (
> https://issues.apache.org/jira/browse/LUCENE-5325?focusedCommentId=15235324&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15235324)
> on the issue seems to refer to wrapper classes to convert between the old
> and new APIs?
> 
> I admit the situation is rather confusing; but we've been gradually working
> on cutting over modules to the new API.  Patches welcome!
> 
> Mike McCandless
> 
> http://blog.mikemccandless.com
> 
> On Tue, Oct 10, 2017 at 3:39 PM, Sokolov, Michael <ms...@gmail.com>
> wrote:
> 
>> Hi, I'm trying to implement a complex set of values computed according to
>> some externally-driven specification, so I am looking at these APIs. My
>> question is whether there is any way to mix them. I have implemented some
>> DoubleValuesSources and now I want combine them using sum, max, etc. I
>> noticed these handy classes over in o.a.l.queries.function.valuesource,
>> but they seem to be of a different flavor than the DVS API is designed for.
>> EG DVS is kind of an iterative API while the functions appear to be random
>> access (you pass them a docid). I could code up my own DVS for functions
>> like max, sum and so on, but I wonder if there is some kind of adapter, or
>> at least a reasonable strategy that would let one mix these apis?
>> 
>> -Mike
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>> 
>> 


Re: FunctionValues vs DoubleValuesSource

Posted by Michael McCandless <lu...@mikemccandless.com>.
Hi Mike,

It looks like FunctionValues is a very old API used by many function
queries, while DoubleValuesSource is relatively new (introduced in
https://issues.apache.org/jira/browse/LUCENE-5325).

This comment (
https://issues.apache.org/jira/browse/LUCENE-5325?focusedCommentId=15235324&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15235324)
on the issue seems to refer to wrapper classes to convert between the old
and new APIs?

I admit the situation is rather confusing; but we've been gradually working
on cutting over modules to the new API.  Patches welcome!

Mike McCandless

http://blog.mikemccandless.com

On Tue, Oct 10, 2017 at 3:39 PM, Sokolov, Michael <ms...@gmail.com>
wrote:

> Hi, I'm trying to implement a complex set of values computed according to
> some externally-driven specification, so I am looking at these APIs. My
> question is whether there is any way to mix them. I have implemented some
> DoubleValuesSources and now I want combine them using sum, max, etc. I
> noticed these handy classes over in o.a.l.queries.function.valuesource,
> but they seem to be of a different flavor than the DVS API is designed for.
> EG DVS is kind of an iterative API while the functions appear to be random
> access (you pass them a docid). I could code up my own DVS for functions
> like max, sum and so on, but I wonder if there is some kind of adapter, or
> at least a reasonable strategy that would let one mix these apis?
>
> -Mike
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>