Affects Version/s: Master
Fix Version/s: None
Component/s: Search Infrastructure
- Create a structure with fields indexed as keyword, number, and text. Fields should be optional. (not mandatory.)
- Create a few articles using this structure. Some articles should leave all fields empty.
- Sort on each field.
- Articles with empty fields are last in order.
- When sorting on the number or text fields, articles with empty fields are last in order.
- When sorting on the keyword field, articles with empty fields are first in order.
- document.addKeywordSortable(name, valueString) for keyword
- document.addTextSortable(name, valueString) otherwise
The method addTextSortable returns immediately if the valueString is null or empty, but the method addKeywordSortable indexes the element even if the valueString is null or empty.
The search engine is solely responsible for indexing a string as keyword or text, so from the application side there's no distinction whatsoever between invoking either method. Therefore DDMIndexerImpl should invoke only addTextSortable. When there's content, the search engine will index it according to its defined mapping (keyword or text) and when there's no content, the field will not be sent to the search engine at all – thus expected sort behavior is achieved.