mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
Further fix for MNT-16921 Unnecessary search calls on type ahead component in Tag Component on the Document Library
- bulk fetch for categories/tags is now limited to 5000 it can be configured higher git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@131814 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -81,7 +81,9 @@ public class LuceneCategoryServiceImpl implements CategoryService
|
||||
|
||||
protected DictionaryService dictionaryService;
|
||||
|
||||
protected IndexerAndSearcher indexerAndSearcher;
|
||||
protected IndexerAndSearcher indexerAndSearcher;
|
||||
|
||||
protected int queryFetchSize = 5000;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -151,19 +153,23 @@ public class LuceneCategoryServiceImpl implements CategoryService
|
||||
public void setIndexerAndSearcher(IndexerAndSearcher indexerAndSearcher)
|
||||
{
|
||||
this.indexerAndSearcher = indexerAndSearcher;
|
||||
}
|
||||
|
||||
public Collection<ChildAssociationRef> getChildren(NodeRef categoryRef, Mode mode, Depth depth)
|
||||
}
|
||||
|
||||
public void setQueryFetchSize(int queryFetchSize) {
|
||||
this.queryFetchSize = queryFetchSize;
|
||||
}
|
||||
|
||||
public Collection<ChildAssociationRef> getChildren(NodeRef categoryRef, Mode mode, Depth depth)
|
||||
{
|
||||
return getChildren(categoryRef, mode, depth, false, null);
|
||||
return getChildren(categoryRef, mode, depth, false, null, queryFetchSize);
|
||||
}
|
||||
|
||||
public Collection<ChildAssociationRef> getChildren(NodeRef categoryRef, Mode mode, Depth depth, String filter)
|
||||
{
|
||||
return getChildren(categoryRef, mode, depth, false, filter);
|
||||
return getChildren(categoryRef, mode, depth, false, filter, queryFetchSize);
|
||||
}
|
||||
|
||||
private Collection<ChildAssociationRef> getChildren(NodeRef categoryRef, Mode mode, Depth depth, boolean sortByName, String filter)
|
||||
private Collection<ChildAssociationRef> getChildren(NodeRef categoryRef, Mode mode, Depth depth, boolean sortByName, String filter, int fetchSize)
|
||||
{
|
||||
if (categoryRef == null)
|
||||
{
|
||||
@@ -226,8 +232,8 @@ public class LuceneCategoryServiceImpl implements CategoryService
|
||||
}
|
||||
searchParameters.setQuery(luceneQuery.toString());
|
||||
searchParameters.setLimit(-1);
|
||||
searchParameters.setMaxItems(Integer.MAX_VALUE);
|
||||
searchParameters.setLimitBy(LimitBy.UNLIMITED);
|
||||
searchParameters.setMaxItems(fetchSize);
|
||||
searchParameters.setLimitBy(LimitBy.FINAL_SIZE);
|
||||
searchParameters.addStore(categoryRef.getStoreRef());
|
||||
resultSet = searcher.query(searchParameters);
|
||||
|
||||
@@ -394,7 +400,7 @@ public class LuceneCategoryServiceImpl implements CategoryService
|
||||
|
||||
OUTER: for(NodeRef nodeRef : nodeRefs)
|
||||
{
|
||||
Collection<ChildAssociationRef> children = getChildren(nodeRef, Mode.SUB_CATEGORIES, Depth.IMMEDIATE, sortByName, filter);
|
||||
Collection<ChildAssociationRef> children = getChildren(nodeRef, Mode.SUB_CATEGORIES, Depth.IMMEDIATE, sortByName, filter, skipCount + maxItems);
|
||||
for(ChildAssociationRef child : children)
|
||||
{
|
||||
count++;
|
||||
@@ -454,7 +460,7 @@ public class LuceneCategoryServiceImpl implements CategoryService
|
||||
Set<NodeRef> nodeRefs = getClassificationNodes(storeRef, aspectName);
|
||||
for (NodeRef nodeRef : nodeRefs)
|
||||
{
|
||||
assocs.addAll(getChildren(nodeRef, Mode.SUB_CATEGORIES, Depth.IMMEDIATE, false, filter));
|
||||
assocs.addAll(getChildren(nodeRef, Mode.SUB_CATEGORIES, Depth.IMMEDIATE, false, filter, queryFetchSize));
|
||||
}
|
||||
return assocs;
|
||||
}
|
||||
|
Reference in New Issue
Block a user