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

Sort widget no longer works with DDM fields on Elasticsearch



      In LPS-103224 we implemented nested fields for DDM. This breaks the sort widget can only support a single top level field to sort on.

      Steps to Reproduce:

      1. [On DXP 7.1 FP20+ and DXP 7.2 FP8+:
        1. Go to System Settings → Dynamic Data Mapping → Dynamic Data Mapping Indexer
        2. Deactivate "Enable Legacy Dynamic Data Mapping Index Fields." check
        3. Execute a full reindex]
      2. Go to Web Content > Structures
      3. Add a new Structure with a text field that is "Indexable - Keyword"
      4. Add two documents using the created structure and fill in the name and text fields:
        • Add a common word to the document titles.
        • Add a different word in the text field to check that they are correctly ordered (for example 'aa' and 'bb')
      5. Go to the Search page and add a Sort Facet widget
      6. Go to the configuration of the Sort Facet widget
      7. Configure in the Sort Facet widget the DDM Structure Field Name you want to use in the facet. There are several ways to get this identifier:
        • Option 1: Get it from Elasticsearch:
          1. Open the URL: http://localhost:9201/_search?q=articleId:99999 (replace the 99999 with your articleId)
          2. It will return the webcontent info. Go to the nested document "ddmFieldArray"
          3. Inside the nested document, get the identifier from the "ddmFieldName" field.
                      "ddmFieldArray": [
                          "ddmFieldName": "ddm__keyword__48313__Text07290686_en_US",
                          "ddmFieldValueKeyword_en_US": "example text",
                          "ddmValueFieldName": "ddmFieldValueKeyword_en_US"
                          "ddmFieldName": "ddm__keyword__48313__Text48292346_en_US",
                          "ddmFieldValueKeyword_en_US": "example text2",
                          "ddmValueFieldName": "ddmFieldValueKeyword_en_US"
        • Option 2: Get it from a groovy script:
          1. Get the structureId and fieldName. You can get it from the DDMStructure table or from the user interface of structure creation
          2. Go to the groovy script console
          3. Execute this groovy script, configuring the structureId and the fieldName
            def structureId = 0000000;
            def fieldName = "xxxxxxxx";
            def registry = com.liferay.registry.RegistryUtil.getRegistry();
            def serviceReference = registry.getServiceReference("com.liferay.dynamic.data.mapping.util.DDMIndexer");
            def ddmIndexer = registry.getService(serviceReference);
            out.println("ddmStructureFieldName: "+ddmIndexer.encodeName(structureId,fieldName,com.liferay.portal.kernel.util.LocaleUtil.fromLanguageId("en_US")));
      8. Execute a search, searching for the common word that you added to the document titles in the step 3

      Expected Result
      The widget displays the webcontents sorted using the specified field

      Actual Result
      The widget doesn't the webcontents sorted using the specified field

      Final note: repeat the test changing the sorting order or the field used to sort the webcontents in order to double check that the sorting is working correctly


          Issue Links



              brian.lee Brian Lee
              jorge.diaz Jorge Diaz
              Participants of an Issue:
              Recent user:
              Sophia Zhang
              0 Vote for this issue
              3 Start watching this issue


                Days since last comment:
                1 year, 23 weeks, 5 days ago
                Development End Date:
                Development Start Date:


                  Version Package
                  7.2.10 DXP FP12
                  7.3.7 CE GA8
                  7.3.10 DXP FP2
                  7.4.0 CE GA1 DXP 7,4
                  7.4.13 DXP GA1