E
E
EVGENIJ NEFEDOV2021-03-17 11:04:49
Sphinx
EVGENIJ NEFEDOV, 2021-03-17 11:04:49

How to implement searching for a range of digits?

There is an industry search, where a bunch of products and their properties, the search works on the basis of the sphinx, and takes into account the industry subject area.
Task: to make it possible to search for products by a range of digital values, as in the filter by properties, only in the search line.
For example, we have 5 lamps in the database whose name indicates the luminous flux 100lm, 500lm, 700lm, 1000lm, 1200lm, we need a lamp with a flux from 500 to 800 lumens, how to make it so that by typing in the line "luminaire {500- 800}lm" lamps came out at 500 and 700 lumens from the above example.
There is an idea to first search for all lamps with lumens and only then, using the primary selection, search for a range with a regular expression, it requires frying.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Tikhonov, 2021-03-17
@nefedovgeka

And why, when adding the next 100500lm to the database, do not parse the string and parse the lumens into a separate integer attribute?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question