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

Custom facet no longer works with DDM fields on Elasticsearch

    Details

      Description

      In LPS-103224 we implemented nested fields for DDM. This breaks the custom facet widget which can only support a single top level field to aggregate 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 a web content using the created structure and fill in the name and text fields.
      5. Go to the Search page and add a Custom Facet widget
      6. Go to the configuration of the Custom Facet widget
      7. Configure in the Custom Facet the DDM Structure Field Name identifier 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.
            Example:
                      "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 name of the document created in step 3

      Expected Result
      The widget displays the value in the webcontents's text field as a facet bucket when

      Actual Result
      The widget doesn't display the value of the webcontents's text field as a facet bucket

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              brooke.dalton Brooke Dalton
              Reporter:
              bryan.engler Bryan Engler
              Participants of an Issue:
              Recent user:
              Tibor Lipusz
              Engineering Assignee:
              Bryan Engler
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                17 hours, 57 minutes ago
                Development End Date:
                Development Start Date:

                  Packages

                  Version Package
                  7.1.10 DXP FP23
                  7.1.10.6 SP6
                  7.1.X
                  7.2.10 DXP FP12
                  7.2.X
                  7.3.10 DXP FP1
                  7.3.10.1 DXP SP1
                  7.3.6 CE GA7
                  7.3.X
                  Master