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:
Andrew Hind
2016-10-26 17:44:11 +00:00
parent 354f66df4c
commit 884ece5cc0
6 changed files with 33 additions and 12 deletions

View File

@@ -1207,3 +1207,6 @@ system.upgradePasswordHash.jobThreadCount=4
system.upgradePasswordHash.jobCronExpression=* * * * * ? 2099
system.api.discovery.enabled=true
# Maximum query size for category/tag fetch when not explicitly set by paging parameters
category.queryFetchSize=5000

View File

@@ -355,6 +355,9 @@
<property name="indexerAndSearcher">
<ref bean="search.indexerAndSearcherFactory" />
</property>
<property name="queryFetchSize">
<value>${category.queryFetchSize}</value>
</property>
</bean>
<!-- Bean to support full text search -->

View File

@@ -284,6 +284,9 @@
<property name="indexerAndSearcher">
<ref bean="search.indexerAndSearcherFactory" />
</property>
<property name="queryFetchSize">
<value>${category.queryFetchSize}</value>
</property>
</bean>
<bean

View File

@@ -307,6 +307,9 @@
<property name="indexerAndSearcher">
<ref bean="search.indexerAndSearcherFactory" />
</property>
<property name="queryFetchSize">
<value>${category.queryFetchSize}</value>
</property>
</bean>
<bean

View File

@@ -307,6 +307,9 @@
<property name="indexerAndSearcher">
<ref bean="search.indexerAndSearcherFactory" />
</property>
<property name="queryFetchSize">
<value>${category.queryFetchSize}</value>
</property>
</bean>
<bean

View File

@@ -83,6 +83,8 @@ public class LuceneCategoryServiceImpl implements CategoryService
protected IndexerAndSearcher indexerAndSearcher;
protected int queryFetchSize = 5000;
/**
*
*/
@@ -153,17 +155,21 @@ public class LuceneCategoryServiceImpl implements CategoryService
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;
}