留言板
Search results count varying on pagination
Sai Sriharsha Kasturi,修改在7 年前。
Search results count varying on pagination
Junior Member 帖子: 34 加入日期: 12-10-21 最近的帖子
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,
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?
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?
Byrån Zaugg,修改在7 年前。
RE: Search results count varying on pagination
Expert 帖子: 252 加入日期: 12-4-6 最近的帖子
This seems like a bug to me. You might be able to get more help from the Portal Development forum, though.
Sai Sriharsha Kasturi,修改在7 年前。
RE: Search results count varying on pagination
Junior Member 帖子: 34 加入日期: 12-10-21 最近的帖子
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.