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 Wei <we...@gmail.com> on 2019/07/11 22:03:19 UTC
Function Query with multi-value field
Hi,
I have a question regarding function query that operates on multi-value
fields. For the following field:
<field name=rgbcolor type="string" indexed="true" stored="true"
multivalued="true"/>
Each value is a hex string representation of RGB value. for example there
are 3 values indexed
#FF00FF - C1
#EE82EE - C2
#DA70D6 - C3
How would I write a function query that operates on all values of the
field? Given color S in query, how to calculate the similarities between S
and C1/C2/C3 and find which one is the closest?
I checked https://lucene.apache.org/solr/guide/6_6/function-queries.html but
didn't see an example.
Thanks,
Wei
Re: Function Query with multi-value field
Posted by Emir Arnautović <em...@sematext.com>.
Hi Wei,
I see two options:
1. create custom distance function for colors
2. split each color component to a separate numeric fields and try calculate distance function using standard set of functions. (I think that Solr does not support 3d points).
HTH,
Emir
--
Monitoring - Log Management - Alerting - Anomaly Detection
Solr & Elasticsearch Consulting Support Training - http://sematext.com/
> On 14 Jul 2019, at 00:47, Wei <we...@gmail.com> wrote:
>
> Any suggestion?
>
> On Thu, Jul 11, 2019 at 3:03 PM Wei <we...@gmail.com> wrote:
>
>> Hi,
>>
>> I have a question regarding function query that operates on multi-value
>> fields. For the following field:
>>
>> <field name=rgbcolor type="string" indexed="true" stored="true"
>> multivalued="true"/>
>>
>> Each value is a hex string representation of RGB value. for example
>> there are 3 values indexed
>>
>> #FF00FF - C1
>> #EE82EE - C2
>> #DA70D6 - C3
>>
>> How would I write a function query that operates on all values of the
>> field? Given color S in query, how to calculate the similarities between
>> S and C1/C2/C3 and find which one is the closest?
>> I checked https://lucene.apache.org/solr/guide/6_6/function-queries.html but
>> didn't see an example.
>>
>> Thanks,
>> Wei
>>
Re: Function Query with multi-value field
Posted by Wei <we...@gmail.com>.
Any suggestion?
On Thu, Jul 11, 2019 at 3:03 PM Wei <we...@gmail.com> wrote:
> Hi,
>
> I have a question regarding function query that operates on multi-value
> fields. For the following field:
>
> <field name=rgbcolor type="string" indexed="true" stored="true"
> multivalued="true"/>
>
> Each value is a hex string representation of RGB value. for example
> there are 3 values indexed
>
> #FF00FF - C1
> #EE82EE - C2
> #DA70D6 - C3
>
> How would I write a function query that operates on all values of the
> field? Given color S in query, how to calculate the similarities between
> S and C1/C2/C3 and find which one is the closest?
> I checked https://lucene.apache.org/solr/guide/6_6/function-queries.html but
> didn't see an example.
>
> Thanks,
> Wei
>