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

Web Content "Select" fields with "Repeatable" enabled are incorrectly stored in the Search Index, which breaks display and filtering on those fields.


    • 4



      When defining a Web Content Structure, fields can be configured to be "Repeatable" - to allow the author to add multiple instances of the same field.  The "Select" field ("Select from List" in 7.4) is often used this way - for example you might have a list of Countries, and want the user to select all that are applicable.

      When this field type is defined in this way the way that this information is stored in the Search Index (Elasticsearch) is different to the same field type when it is not configured to be Repeatable, with the addition of extra "wrapping" characters.  These additional characters are in turn displayed to the end-user incorrectly in the "Custom Facet" widget.  Furthermore, while it is possible to correctly encode these characters to enable filtering on one value to work, this is not currently working in the product and therefore it renders filtering on these fields impossible.

      Expected Behaviour

      It should be possible to add a Custom Facet widget to a Search Page, configure it against the repeatable Select/Select from List field, and for end users to filter search results by one or more value.

      Observed Behaviour

      Multiple issues are observed:

      • Stored values are wrapped in additional characters - for example, if the value presented to the content author is

        then it will be stored in the Elasticsearch index as

      • This value is rendered in the Custom Facet widget as

      Notes and further details

      Two possible options seem to be available for resolution of this issue:

      1. Change the values that are stored in the Elasticsearch index to prevent the issue occurring in the first place
      2. Or - if there's a legitimate reason for the wrapping characters being present, modify the Custom Facet widget to (a) strip those characters from being displayed and (b) correctly URL encode the string so that search works as expected

      An example search page with a simple structure that demonstrates this issue has been setup on Alexandria here.  I can easily grant Admin access.

      Samples of the Database entry for a record with these fields, as well as the Elasticsearch index for this entry are attached.  Screenshots are also included.

      While the examples used are from a 7.3 environment, the same problem is present in 7.4.  In fact, because of LPS-146728 the problem is actually more pronounced.

      Steps to Reproduce

      1. Add a new Web Content Structure
      2. Add a "Select" field to the structure, configure this field wit the "Repeatable" property set to "Yes".
      3. Add multiple options to the Select field.
      4. For example, add a field called "Country" and add multiple Countries as options - Australia, Spain, USA, Finland, Hungary
      5. As a "control", add a second Select field, with the "Repeatable" property set to "No".
      6. Add a web content article and add the repeatable field multiple times with different options.
      7. Create a custom search page which shows only results for this Web Content Structure (use the Custom Filter widget to filter by ddmStructureKey)
      8. Add a Custom Facet widget for each of the Select fields.  You'll need to query to Elasticsearch index to find the field name using curl - e.g.:
        curl "localhost:9201/_search?q=articleId:102161385&pretty=true"
      9. Access the new page and attempt to filter on the Repeatable Select field.





            support-lep@liferay.com SE Support
            benjamin.turner Benjamin Turner
            Rafaela Nascimento Rafaela Nascimento
            1 Vote for this issue
            1 Start watching this issue


              1 year, 15 weeks, 6 days ago


                Version Package