Merged V3.0 to HEAD

12291: Fix for ETHREEOH: Post query sort for datetime types tokenised as dates is slow for many query results. Add config to disable.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@12528 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2008-12-22 11:29:51 +00:00
parent ee74529c57
commit eca46db62b
4 changed files with 36 additions and 7 deletions

View File

@@ -559,9 +559,13 @@
<property name="threadPoolExecutor"> <property name="threadPoolExecutor">
<ref bean="indexThreadPoolExecutor"></ref> <ref bean="indexThreadPoolExecutor"></ref>
</property> </property>
<property name="bulkLoader"> <property name="bulkLoader">
<ref bean="hibernateL1CacheBulkLoader"></ref> <ref bean="hibernateL1CacheBulkLoader"></ref>
</property> </property>
<!-- over-ride to false for pre 3.0 behaviour -->
<property name="postSortDateTime">
<value>true</value>
</property>
</bean> </bean>
@@ -690,6 +694,10 @@
<property name="threadPoolExecutor"> <property name="threadPoolExecutor">
<ref bean="indexThreadPoolExecutor"></ref> <ref bean="indexThreadPoolExecutor"></ref>
</property> </property>
<!-- over-ride to false for pre 3.0 behaviour -->
<property name="postSortDateTime">
<value>true</value>
</property>
</bean> </bean>

View File

@@ -26,9 +26,7 @@ package org.alfresco.repo.search.impl.lucene;
import java.io.IOException; import java.io.IOException;
import java.io.Serializable; import java.io.Serializable;
import java.io.StringReader;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@@ -48,8 +46,6 @@ import org.alfresco.repo.search.SearcherException;
import org.alfresco.repo.search.impl.NodeSearcher; import org.alfresco.repo.search.impl.NodeSearcher;
import org.alfresco.repo.search.impl.lucene.QueryParser.Operator; import org.alfresco.repo.search.impl.lucene.QueryParser.Operator;
import org.alfresco.repo.search.impl.lucene.analysis.DateTimeAnalyser; import org.alfresco.repo.search.impl.lucene.analysis.DateTimeAnalyser;
import org.alfresco.repo.search.impl.lucene.analysis.MLTokenDuplicator;
import org.alfresco.repo.search.impl.lucene.analysis.VerbatimAnalyser;
import org.alfresco.repo.search.results.SortedResultSet; import org.alfresco.repo.search.results.SortedResultSet;
import org.alfresco.repo.tenant.TenantService; import org.alfresco.repo.tenant.TenantService;
import org.alfresco.service.cmr.dictionary.DataTypeDefinition; import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
@@ -391,7 +387,7 @@ public class ADMLuceneSearcherImpl extends AbstractLuceneBase implements LuceneS
Path[] paths = searchParameters.getAttributePaths().toArray(new Path[0]); Path[] paths = searchParameters.getAttributePaths().toArray(new Path[0]);
ResultSet rs = new LuceneResultSet(hits, searcher, nodeService, tenantService, paths, searchParameters, getLuceneConfig()); ResultSet rs = new LuceneResultSet(hits, searcher, nodeService, tenantService, paths, searchParameters, getLuceneConfig());
if (requiresPostSort) if(getLuceneConfig().getPostSortDateTime() && requiresPostSort)
{ {
ResultSet sorted = new SortedResultSet(rs, nodeService, searchParameters, namespacePrefixResolver); ResultSet sorted = new SortedResultSet(rs, nodeService, searchParameters, namespacePrefixResolver);
return sorted; return sorted;

View File

@@ -185,6 +185,8 @@ public abstract class AbstractLuceneIndexerAndSearcherFactory implements LuceneI
private boolean cacheEnabled = true; private boolean cacheEnabled = true;
private boolean postSortDateTime;
private ConfigurableApplicationContext applicationContext; private ConfigurableApplicationContext applicationContext;
/** /**
@@ -1716,6 +1718,16 @@ public abstract class AbstractLuceneIndexerAndSearcherFactory implements LuceneI
{ {
this.cacheEnabled = cacheEnabled; this.cacheEnabled = cacheEnabled;
} }
public boolean getPostSortDateTime()
{
return postSortDateTime;
}
public void setPostSortDateTime(boolean postSortDateTime)
{
this.postSortDateTime = postSortDateTime;
}
protected abstract List<StoreRef> getAllStores(); protected abstract List<StoreRef> getAllStores();

View File

@@ -209,7 +209,20 @@ public interface LuceneConfig
* @return * @return
*/ */
public int getMaxLinkAspectCacheSize(); public int getMaxLinkAspectCacheSize();
/**
* If we are using the DateAnalyser then lucene sort is only to the date, as that is all that is in the index.
* If this is true, a query that defines a sort on a datetime field will do a post sort in Java.
*
* For the DateTimeAnalyser no post sort is done.
* (The default config does do a post sort)
*
* In the future, this behaviour may also be set per query on the SearchParameters object.
*
* @return
*/
public boolean getPostSortDateTime();
/** /**
* Gets the application context through which events can be broadcast * Gets the application context through which events can be broadcast
* @return * @return