Solr numerical searching on text field

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Solr numerical searching on text field

Neha IndiaMART
Hi All,

I have a query regarding the searching of numerical based searches in the
solr text field.

we have a text field (isq) which contains the description of a product.

*product*:  Elanpro Metal Mini Bar Solid Door Refrigerator, Top-Freezer, 2
To 12 Deg C

*Definition of field:- *
<field name="isq" type="text" indexed="false" stored="true"
required="false" multiValued="true"/>


*Data index is looking like:-*
 "isq": [
"Door Type==Single Door",
"Color==Black",
"Body Material==Metal",
"Type==Top-Freezer",
"Temperature Range==2 to 12 Deg C",
"Brand==Elanpro",
"Capacity==30-60 Liters"
]



*Query*:- Now I want to fetch the products which have capacity "upto 100"..

    fq=isq:"upto 100"

How we can make a solr query to fetch the above product which has capacity
upto 100.
How can I use fq for this problem.

--

Reply | Threaded
Open this post in threaded view
|

Re: Solr numerical searching on text field

Alessandro Benedetti
Hi,
it seems you have structured information (your map field-> value(s))
indexed in an unstructured field 'isq' .
My strong recommendation would be to design your data model creating the
corresponding fields in the schema (with a proper type associated).
With some effort in the indexing pipeline, you will have an elegant
document in Apache Solr, easy to query/

For example, you could add a numeric field called "product_capacity" and
then do a simple range query such as :
fq=product_capacity:[ * TO 100]

Extracting structure from your data could be not easy, but it may be
convenient for you.
Alternatives may be to identify quantities in the text.
My colleague Andrea worked on and contributed this plugin in the past:
https://sease.io/2018/04/solr-quantity-detection-plugin.html
https://github.com/SeaseLtd/solr-quantities-detection-qparsers
<https://sease.io/2018/04/solr-quantity-detection-plugin.html>

<https://sease.io/2018/04/solr-quantity-detection-plugin.html>
Cheers

--------------------------
Alessandro Benedetti
Apache Lucene/Solr Committer
Director, R&D Software Engineer, Search Consultant

www.sease.io


On Tue, 4 May 2021 at 11:21, Neha IndiaMART <[hidden email]>
wrote:

> Hi All,
>
> I have a query regarding the searching of numerical based searches in the
> solr text field.
>
> we have a text field (isq) which contains the description of a product.
>
> *product*:  Elanpro Metal Mini Bar Solid Door Refrigerator, Top-Freezer, 2
> To 12 Deg C
>
> *Definition of field:- *
> <field name="isq" type="text" indexed="false" stored="true"
> required="false" multiValued="true"/>
>
>
> *Data index is looking like:-*
>  "isq": [
> "Door Type==Single Door",
> "Color==Black",
> "Body Material==Metal",
> "Type==Top-Freezer",
> "Temperature Range==2 to 12 Deg C",
> "Brand==Elanpro",
> "Capacity==30-60 Liters"
> ]
>
>
>
> *Query*:- Now I want to fetch the products which have capacity "upto 100"..
>
>     fq=isq:"upto 100"
>
> How we can make a solr query to fetch the above product which has capacity
> upto 100.
> How can I use fq for this problem.
>
> --
>
>
---------------
Alessandro Benedetti
Search Consultant, R&D Software Engineer, Director
Sease Ltd. - www.sease.io