Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-94743

Sort on optional DDM fields must present consistent behavior



      Steps to reproduce

      1. Create a structure with fields indexed as keyword, number, and text. Fields should be optional. (not mandatory.)
      2. Create a few articles using this structure. Some articles should leave all fields empty.
      3. Sort on each field.


      1. Articles with empty fields are last in order.


      1. When sorting on the number or text fields, articles with empty fields are last in order.
      2. When sorting on the keyword field, articles with empty fields are first in order.


      Probable cause

      DDMIndexerImpl invokes:

      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.





            • Votes:
              0 Vote for this issue
              0 Start watching this issue


              • Created:
                Days since last comment:
                1 year, 4 weeks, 2 days ago


                Version Package