Mailing List Archive

currency based search using query time calculated field match with expression
I am having one use case regarding currency based search. I want to get any
suggestions or pointers..

For example,
Assume,
1USD = 75 INR
1USD = 42190 IRR
similarly, we have support for 100 currencies as of now.

Record1 created with PRICE 150 INR & EXCHANGE_RATE 75 for USD
Record2 created with PRICE 84380 IRR & EXCHANGE_RATE 42190 for USD

If i search 2 ( USD ), I would like to get both Record1 & Record2 as search
results

PRICE & EXCHANGE_RATE are indexed & stored as separate fields in the search
index
We can have 50 number of currency fields like PRICE. so we may need to
index additional 50 fields holding USD values.

To avoid additional fields, Is it possible to match records in the search
index by applying an expression like (PRICE / EXCHANGE_RATE )

I am not sure if this is the right use case for Lucene index. But I would
like to know the possibilities. Thanks in advance


--
Kumaran R
Chennai, India
Re: currency based search using query time calculated field match with expression [ In reply to ]
Have you looked at the expressions module? It provides support for
user-defined computation using values from the index based on a simple
expression language. It might prove useful to you if the exchange rate
needs to be tracked very dynamically.

On Thu, Sep 2, 2021 at 2:15 PM Kumaran Ramasubramanian
<kums.134@gmail.com> wrote:
>
> I am having one use case regarding currency based search. I want to get any
> suggestions or pointers..
>
> For example,
> Assume,
> 1USD = 75 INR
> 1USD = 42190 IRR
> similarly, we have support for 100 currencies as of now.
>
> Record1 created with PRICE 150 INR & EXCHANGE_RATE 75 for USD
> Record2 created with PRICE 84380 IRR & EXCHANGE_RATE 42190 for USD
>
> If i search 2 ( USD ), I would like to get both Record1 & Record2 as search
> results
>
> PRICE & EXCHANGE_RATE are indexed & stored as separate fields in the search
> index
> We can have 50 number of currency fields like PRICE. so we may need to
> index additional 50 fields holding USD values.
>
> To avoid additional fields, Is it possible to match records in the search
> index by applying an expression like (PRICE / EXCHANGE_RATE )
>
> I am not sure if this is the right use case for Lucene index. But I would
> like to know the possibilities. Thanks in advance
>
>
> --
> Kumaran R
> Chennai, India

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: currency based search using query time calculated field match with expression [ In reply to ]
Hi Michael, Thanks for the response.

Based on my understanding, we can use the expressions module in lucene to
reorder search results using custom score calculations based on expression
using stored fields.

But i am not sure how to do the same for lucene document hits(doc hits
matching 2 USD with 150 INR records). Any pointers to know about this in
detail?


Kumaran R
Chennai, India



On Fri, Sep 3, 2021 at 12:08 AM Michael Sokolov <msokolov@gmail.com> wrote:

> Have you looked at the expressions module? It provides support for
> user-defined computation using values from the index based on a simple
> expression language. It might prove useful to you if the exchange rate
> needs to be tracked very dynamically.
>
> On Thu, Sep 2, 2021 at 2:15 PM Kumaran Ramasubramanian
> <kums.134@gmail.com> wrote:
> >
> > I am having one use case regarding currency based search. I want to get
> any
> > suggestions or pointers..
> >
> > For example,
> > Assume,
> > 1USD = 75 INR
> > 1USD = 42190 IRR
> > similarly, we have support for 100 currencies as of now.
> >
> > Record1 created with PRICE 150 INR & EXCHANGE_RATE 75 for USD
> > Record2 created with PRICE 84380 IRR & EXCHANGE_RATE 42190 for USD
> >
> > If i search 2 ( USD ), I would like to get both Record1 & Record2 as
> search
> > results
> >
> > PRICE & EXCHANGE_RATE are indexed & stored as separate fields in the
> search
> > index
> > We can have 50 number of currency fields like PRICE. so we may need to
> > index additional 50 fields holding USD values.
> >
> > To avoid additional fields, Is it possible to match records in the search
> > index by applying an expression like (PRICE / EXCHANGE_RATE )
> >
> > I am not sure if this is the right use case for Lucene index. But I would
> > like to know the possibilities. Thanks in advance
> >
> >
> > --
> > Kumaran R
> > Chennai, India
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
Re: currency based search using query time calculated field match with expression [ In reply to ]
Sorry I'm not sure I understand what you're trying to do. Maybe you
want to match a document having a computed value? This is going to be
potentially costly, potentially requiring post-filtering of all hits
matching for other reasons. I think there is a
FunctionQuery/FunctionRangeQuery that might help, but I don't have
much experience with this API, so I'm not sure. If you want useful
suggestions, you need to be much more explicit about your use case,
what you've tried, why it didn't work, etc.

On Fri, Sep 3, 2021 at 6:08 AM Kumaran Ramasubramanian
<kums.134@gmail.com> wrote:
>
> Hi Michael, Thanks for the response.
>
> Based on my understanding, we can use the expressions module in lucene to
> reorder search results using custom score calculations based on expression
> using stored fields.
>
> But i am not sure how to do the same for lucene document hits(doc hits
> matching 2 USD with 150 INR records). Any pointers to know about this in
> detail?
>
>
> Kumaran R
> Chennai, India
>
>
>
> On Fri, Sep 3, 2021 at 12:08 AM Michael Sokolov <msokolov@gmail.com> wrote:
>
> > Have you looked at the expressions module? It provides support for
> > user-defined computation using values from the index based on a simple
> > expression language. It might prove useful to you if the exchange rate
> > needs to be tracked very dynamically.
> >
> > On Thu, Sep 2, 2021 at 2:15 PM Kumaran Ramasubramanian
> > <kums.134@gmail.com> wrote:
> > >
> > > I am having one use case regarding currency based search. I want to get
> > any
> > > suggestions or pointers..
> > >
> > > For example,
> > > Assume,
> > > 1USD = 75 INR
> > > 1USD = 42190 IRR
> > > similarly, we have support for 100 currencies as of now.
> > >
> > > Record1 created with PRICE 150 INR & EXCHANGE_RATE 75 for USD
> > > Record2 created with PRICE 84380 IRR & EXCHANGE_RATE 42190 for USD
> > >
> > > If i search 2 ( USD ), I would like to get both Record1 & Record2 as
> > search
> > > results
> > >
> > > PRICE & EXCHANGE_RATE are indexed & stored as separate fields in the
> > search
> > > index
> > > We can have 50 number of currency fields like PRICE. so we may need to
> > > index additional 50 fields holding USD values.
> > >
> > > To avoid additional fields, Is it possible to match records in the search
> > > index by applying an expression like (PRICE / EXCHANGE_RATE )
> > >
> > > I am not sure if this is the right use case for Lucene index. But I would
> > > like to know the possibilities. Thanks in advance
> > >
> > >
> > > --
> > > Kumaran R
> > > Chennai, India
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: java-user-help@lucene.apache.org
> >
> >

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: currency based search using query time calculated field match with expression [ In reply to ]
Thanks a lot for your inputs Michael. I will check about FunctionQuery.
Thanks again :-)

--
Kumaran R
Chennai, India




On Fri, Sep 3, 2021 at 9:22 PM Michael Sokolov <msokolov@gmail.com> wrote:

> Sorry I'm not sure I understand what you're trying to do. Maybe you
> want to match a document having a computed value? This is going to be
> potentially costly, potentially requiring post-filtering of all hits
> matching for other reasons. I think there is a
> FunctionQuery/FunctionRangeQuery that might help, but I don't have
> much experience with this API, so I'm not sure. If you want useful
> suggestions, you need to be much more explicit about your use case,
> what you've tried, why it didn't work, etc.
>
> On Fri, Sep 3, 2021 at 6:08 AM Kumaran Ramasubramanian
> <kums.134@gmail.com> wrote:
> >
> > Hi Michael, Thanks for the response.
> >
> > Based on my understanding, we can use the expressions module in lucene to
> > reorder search results using custom score calculations based on
> expression
> > using stored fields.
> >
> > But i am not sure how to do the same for lucene document hits(doc hits
> > matching 2 USD with 150 INR records). Any pointers to know about this in
> > detail?
> >
> >
> > Kumaran R
> > Chennai, India
> >
> >
> >
> > On Fri, Sep 3, 2021 at 12:08 AM Michael Sokolov <msokolov@gmail.com>
> wrote:
> >
> > > Have you looked at the expressions module? It provides support for
> > > user-defined computation using values from the index based on a simple
> > > expression language. It might prove useful to you if the exchange rate
> > > needs to be tracked very dynamically.
> > >
> > > On Thu, Sep 2, 2021 at 2:15 PM Kumaran Ramasubramanian
> > > <kums.134@gmail.com> wrote:
> > > >
> > > > I am having one use case regarding currency based search. I want to
> get
> > > any
> > > > suggestions or pointers..
> > > >
> > > > For example,
> > > > Assume,
> > > > 1USD = 75 INR
> > > > 1USD = 42190 IRR
> > > > similarly, we have support for 100 currencies as of now.
> > > >
> > > > Record1 created with PRICE 150 INR & EXCHANGE_RATE 75 for USD
> > > > Record2 created with PRICE 84380 IRR & EXCHANGE_RATE 42190 for USD
> > > >
> > > > If i search 2 ( USD ), I would like to get both Record1 & Record2 as
> > > search
> > > > results
> > > >
> > > > PRICE & EXCHANGE_RATE are indexed & stored as separate fields in the
> > > search
> > > > index
> > > > We can have 50 number of currency fields like PRICE. so we may need
> to
> > > > index additional 50 fields holding USD values.
> > > >
> > > > To avoid additional fields, Is it possible to match records in the
> search
> > > > index by applying an expression like (PRICE / EXCHANGE_RATE )
> > > >
> > > > I am not sure if this is the right use case for Lucene index. But I
> would
> > > > like to know the possibilities. Thanks in advance
> > > >
> > > >
> > > > --
> > > > Kumaran R
> > > > Chennai, India
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > > For additional commands, e-mail: java-user-help@lucene.apache.org
> > >
> > >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>