Forums de discussion

Search results count varying on pagination

thumbnail
Sai Sriharsha Kasturi, modifié il y a 7 années.

Search results count varying on pagination

Junior Member Publications: 34 Date d'inscription: 21/10/12 Publications récentes
I have an issue in my search portlet. I'm using more pagination.
When I search for a word, I'm getting a proper total count for Administrator. But when I try to search for the same word with another user who have relatively less permissions than Administrator, it is showing a different total count. But, that is totally understandable as he have less permissions. But when I click on Show More it is showing different total count. Here is my code,


ThemeDisplay themeDisplay = (ThemeDisplay) request
				.getAttribute(WebKeys.THEME_DISPLAY);

		long groupId = themeDisplay.getScopeGroupId();
		
		SearchContext searchContext1 = SearchContextFactory.getInstance(PortalUtil.getHttpServletRequest(request));
		
		Facet assetEntriesFacet = new AssetEntriesFacet(searchContext1);
		assetEntriesFacet.setStatic(true);            
		searchContext1.addFacet(assetEntriesFacet);

		String[] entryClassNames = { DLFileEntry.class.getName()}; // Replace this value
		searchContext1.setEntryClassNames(entryClassNames);

		Facet scopeFacet = new ScopeFacet(searchContext1);
		scopeFacet.setStatic(true);            
		searchContext1.addFacet(scopeFacet);

		long[] groupIds = new long[]{groupId}; 
		searchContext1.setGroupIds(groupIds);
		
		
		searchContext1.setStart(0);
		searchContext1.setEnd(25);
		searchContext1.setKeywords("sales");
		
		searchContext1.setUserId(themeDisplay.getUserId());
		
		searchContext1.setScopeStrict(Boolean.TRUE);
		
		Indexer indexer1 = FacetedSearcher.getInstance();
		
		Hits hits1 = null;
		
		try {
			hits1 = indexer1.search(searchContext1);
			//System.out.println(indexer1.getFullQuery(searchContext1));
			watch.stop();
		} catch (SearchException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		
		
		System.out.println("The new search hits---"+hits1.getLength());


When I search for the first time it showed me 599 results. When I clicked on Show More the total count is 594

I found the same behavior when I'm changing the searchContext1.setEnd() value.
Suppose, if I set setEnd(25), the hits1.toLength() is 599, if I set to setEnd(50), the hits1.toLength() is 594.


Is this a bug in Liferay or am I doing wrong?
thumbnail
Byrån Zaugg, modifié il y a 7 années.

RE: Search results count varying on pagination

Expert Publications: 252 Date d'inscription: 06/04/12 Publications récentes
This seems like a bug to me. You might be able to get more help from the Portal Development forum, though.
thumbnail
Sai Sriharsha Kasturi, modifié il y a 7 années.

RE: Search results count varying on pagination

Junior Member Publications: 34 Date d'inscription: 21/10/12 Publications récentes
I found out the issue. I'm overriding Liferay Permission checker with my own permission checker. When I removed my custom permission checker it is showing the count properly.