Xperience By Kentico Lucene index sorting

July 4, 2024 3:15 PM

I'm battling with index results sorting using the Xperience By Kentico Lucene integration, I thought it was working during earlier testing but I have updated the version since then.

I've been looking through the XbyK Lucene repository and docs and I've picked up in the examples that they've now included a SortableTitle on top of the normal title (one is tokenized and the other not) and I've tried to include the same, however I still seem to have having the same issues.

It looks like its attempting to do a z-a sort in my case starting with a 'Z' item but 2nd item is already out of place and should be a the end of the listing

Having picked up on the SortableTitle and it being a non-tokenized string I guess the first question I'm asking is have I missed anything relating to that I might have missed?


Environment

  • Xperience by Kentico version: [29.0.1]
  • Kentico Xperience Lucene [7.0.1]
  • .NET version: [8]

Answers

I'm assuming you are referring to the advanced search example in the DancingGoat project?

Which analyzer are you using? The StandardAnalyzer uses a LowerCaseFilter to ensure values are normalized (e.g. all lowercase) on tokenized fields.

Also, you mention that you aren't tokenizing your sortable field - are you using StringField? That field type is not tokenized, which means it's not normalized.

When adding the title to the index you might want to try calling .ToLower() or .ToLowerInvariant() on the value so you don't have any issues with alphanumeric sorting.

To answer this question, you have to login first.