SmartSearch filter SKUPrice by range

benyamin jain asked on May 14, 2016 14:12

Hi,

In KenticoCMS V7.0 (hotfix 94 applied) ,I have a smart search dialog that let the user to specify price range. when the user clicks on search , i create a query like this :

skuprice:[(double)0.0 TO (double)300000.0] or skuprice:[0 TO 300000] or +skuprice:[0 TO 300000]

**this is my search snippet inside the results webpart:**
SearchParameters parameters = new SearchParameters()
            {
                SearchFor = "skuprice:[(double)0.0 TO (double)300000.0]"/*searchText*/,
                SearchSort = SearchHelper.GetSort(srt),
                Path = path,
                ClassNames = DocumentTypes,
                CurrentCulture = culture,
                DefaultCulture = defaultCulture,
                CombineWithDefaultCulture = CombineWithDefaultCulture,
                CheckPermissions = CheckPermissions,
                SearchInAttachments = SearchInAttachments,
                User = (UserInfo)CMSContext.CurrentUser,
                SearchIndexes = Indexes,
                StartingPosition = startPosition,
                DisplayResults = displayResults,
                NumberOfProcessedResults = numberOfProceeded,
                NumberOfResults = 0,
                AttachmentWhere = AttachmentsWhere,
                AttachmentOrderBy = AttachmentsOrderBy,
                BlockFieldOnlySearch = BlockFieldOnlySearch,
            };

            // Search
            DataSet results = SearchHelper.Search(parameters);

but results dataset always null. what is going wrong here and how i can make this work properly?

Analizer Type : Standard

SKUPrice has been set to searchable

Thank you

Correct Answer

Anton Grekhovodov answered on May 16, 2016 06:59

Hi Benyamin,

You can use Luke for testing you search queries

All values in index are stored as strings. You can read about it here

So you should convert your double values to correct string values: Image Text

1 votesVote for this answer Unmark Correct answer

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