Smart search index storing SKU Price in incorrect format

Al Burns asked on November 6, 2020 17:46

Hi. I am having an issue testing a Lucene search query for a price range.

I have products setup with prices such as 6.99 or 18. I am testing the following query using Luke:

+skuprice:[10.00 TO 20.00]

But when testing this in Luke I can see the values in the skuprice column for the search index are coming back with 101 or 102 prefixed to the value so the prices look like 1016.99 or 10218. This is then causing my search to return an incorrect result set.

Can anyone shed light on why is this happening and what I can do to resolve this so I can do an accurate price search?

If this is just a quirk of Luke will it run OK when I build the lucene search string in my back end using the above query?

Many thanks.

Recent Answers


Dmitry Bastron answered on November 6, 2020 18:55

Hi Al,

Please refer to this documentation article covering Lucene syntax with Kentico. It looks like you should be querying something like this:

+skuprice:[(double)10.00 TO (double)20.00]
0 votesVote for this answer Mark as a Correct answer

Al Burns answered on November 9, 2020 11:27

Hi Dmitry, thanks for your reply.

I have tested with several products with prices ranging between 0 and £10. Coding the following query in the CMS.Search.SearchParameters.SearchFor field does not work:

"+skuprice:[(double)0 TO (double)10] "

However, if I code it like this then it does:

"+skuprice:[1010 TO 10210] "

This is not really ideal. I don't understand why the example you highlighted from the documentation doesn't work but obviously I can use this format if needs be. The only thing is if this 101/102 format should change then my search functionality will break.

Have you any idea why this is happening? Many thanks.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.