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

searchContext not returning requested search results

Details

    • Bug
    • Status: Closed
    • Resolution: Fixed
    • 6.1.1 CE GA2, 6.1.20 EE GA2
    • Legacy, Legacy > API
    • LIFERAY VERSION: 6.1 GA2
      OPERATING SYSTEM: Windows Server 2008
      APPLICATION SERVER: Tomcat 7.0
      JAVA VIRTUAL MACHINE: Java 6
      DATABASE: SQL Server 2008 R2

    Description

      Use the following code

      String defaultAssetcategoryIds = "1693623,1693624,1693625";
      
      List<Document> documents = null;
      SearchContext searchContext = SearchContextFactory.getInstance(origrequest);
      searchContext.setCompanyId(themeDisplay.getCompanyId());
      searchContext.setGroupIds(new long[] {themeDisplay.getScopeGroupId()});
      searchContext.setLocale(themeDisplay.getLocale());
      searchContext.setTimeZone(themeDisplay.getTimeZone());
      searchContext.setKeywords(q);
      						 	
      searchContext.setAssetCategoryIds(StringUtil.split(defaultAssetcategoryIds,0L));
      						 
      searchContext.setEnd(20);
      searchContext.setStart(0);
      String[] entryCalssName = {JournalArticle.class.getName()};
      searchContext.setEntryClassNames(entryCalssName);
      						
      Hits hits = indexer.search(searchContext);
      documents = hits.toList();

      in a portlet and notice that ALL documents return and not just the ones specified via AssetCategoryIds.

      NOTE: Categories will need to be created and their IDs will need to be played in defaultAssetcategoryIds

      Attachments

        Issue Links

          Activity

            People

              sharry.shi Sharry Shi
              jeremy.marshall Jeremy Marshall (Inactive)
              Kiyoshi Lee Kiyoshi Lee
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                9 years, 5 weeks, 3 days ago

                Packages

                  Version Package
                  6.1.2 CE GA3
                  6.1.30 EE GA3
                  6.2.0 CE M6