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

Search DLFileEntry objects is not working properly

    Details

      Description

      When you try to search objects of the Document Library (DLFileEntry) on a custom search portlet, it always returns 1 element, but with other elements like JournalArticle, it returns the right number of elements.

      I'll explain:

      I'm trying to do a custom search in a JSP file of a portlet via the following code

      Indexer indexer = IndexerRegistryUtil.getIndexer(DLFileEntry.class);
      SearchContext sc = SearchContextFactory.getInstance(request);
      sc.setStart(QueryUtil.ALL_POS);
      sc.setEnd(QueryUtil.ALL_POS);
      sc.setGroupIds(new long[]{themeDisplay.getScopeGroupId()});
       
      try {
      	Hits hits = indexer.search(sc);
      	Document [] documents = hits.getDocs();
      	%>Elements size: <%= documents.length %><br><%
      } catch (SearchException e) {
      	%> 
      	SearchException: <%= e.getMessage() %><br>
      	<%
      }
       %>
      

      I checked in the Document Library, and it must return more than one element, but it always return only one. I tried to change the class name to JournalArticle, and it returned the rigth number of elements. I also checked its performance in the 6.0 version of Liferay and in that version, it returned more than one element.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                5 years, 21 weeks ago

                Packages

                Version Package
                6.2.X EE
                7.0.0 M3