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

If you have some DDMFormInstance or DDMStructure objects, the search result count won't match with the quantity of results unless you add the "Type Facet" portlet

    Details

      Description

      If you have some DDMFormInstance or DDMStructure objects, the search result count won't match with the quantity of results unless you add the "Type Facet" portlet to the search page.

      Root cause
      Search Result portlet gets a summary from each object returned from Elasticsearch using the AssetRenderer or the Indexer of the object.
      In case there is a object without a valid summary, (for example DDMFormInstance or DDMStructure objects) that object will be discarted and won't be displayed in Search Result portlet body. This logic was added in LPS-72676.
      However, the number of results that is displayed in the top of Search Result portlet will count them as this data comes directly from Elasticsearch searchResponse, without filtering the results.

      For more information see following code:

      1. https://github.com/liferay/liferay-portal/blob/dedeb279e3dfed0f1d0074682df08b919ff4d5f9/modules/apps/portal-search/portal-search-web/src/main/java/com/liferay/portal/search/web/internal/result/display/builder/SearchResultSummaryDisplayBuilder.java#L321-L337
      2. https://github.com/liferay/liferay-portal/blob/dedeb279e3dfed0f1d0074682df08b919ff4d5f9/modules/apps/portal-search/portal-search-web/src/main/java/com/liferay/portal/search/web/internal/result/display/builder/SearchResultSummaryDisplayBuilder.java#L824-L863
      3. https://github.com/liferay/liferay-portal/blob/dedeb279e3dfed0f1d0074682df08b919ff4d5f9/modules/apps/portal-search/portal-search-web/src/main/java/com/liferay/portal/search/web/internal/search/results/portlet/SearchResultsPortlet.java#L287-L298

      In the second link, it seems not having a AssetRenderer is ok if indexer is able to return a summary different to null

      Additional note
      Issue is not reproduced in case you add "Type Facet" portlet to the page, because that portlet adds a filter by entryClassName that doesn't include any entity without AssetRenderer, so it is not possible to have a null summary with that filter.

      Steps to reproduce with Forms

      1. Create a new site, and enter inside it.
      2. Create the "home" page of the site
      3. Create the "search" page of the site
      4. Add "Search Result" portlet to the "search" page. Don't add any other portlet
      5. Go to WebContent section and create a webcontent called "test"
      6. Go to Forms section and create a form called "test" with a text field
      7. Go to "home" page and search "test" word:
        • Expected behavior: the number of results displayed in the top of the "Search Result" portlet matches with the quantity of results
        • Wrong behavior: the number of results displayed in the top of the "Search Result" portlet doesn't match with the number of results, it is greater than the real quantity of results

      Steps to reproduce with Webcontent Structures

      1. Create a new site, and enter inside it.
      2. Create the "home" page of the site
      3. Create the "search" page of the site
      4. Add "Search Result" portlet to the "search" page. Don't add any other portlet
      5. Go to WebContent section and create a webcontent called "test"
      6. Create a webcontent structure and call it test, also
      7. Go to "home" page and search "test" word:
        • Expected behavior: the number of results displayed in the top of the "Search Result" portlet matches with the quantity of results
        • Wrong behavior: the number of results displayed in the top of the "Search Result" portlet doesn't match with the number of results, it is greater than the real quantity of results

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              linda.sui Linda Sui
              Reporter:
              jorge.diaz Jorge Diaz
              Participants of an Issue:
              Recent user:
              Jason Pince
              Engineering Assignee:
              Bryan Engler
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                27 weeks, 6 days ago

                  Packages

                  Version Package
                  7.2.10 DXP FP5
                  7.2.10.2 DXP SP2
                  7.2.X
                  7.3.10 DXP GA1
                  Master