mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
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:
@@ -26,9 +26,7 @@ package org.alfresco.repo.search.impl.lucene;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.io.StringReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
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.lucene.QueryParser.Operator;
|
||||
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.tenant.TenantService;
|
||||
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]);
|
||||
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);
|
||||
return sorted;
|
||||
|
@@ -185,6 +185,8 @@ public abstract class AbstractLuceneIndexerAndSearcherFactory implements LuceneI
|
||||
|
||||
private boolean cacheEnabled = true;
|
||||
|
||||
private boolean postSortDateTime;
|
||||
|
||||
private ConfigurableApplicationContext applicationContext;
|
||||
|
||||
/**
|
||||
@@ -1716,6 +1718,16 @@ public abstract class AbstractLuceneIndexerAndSearcherFactory implements LuceneI
|
||||
{
|
||||
this.cacheEnabled = cacheEnabled;
|
||||
}
|
||||
|
||||
public boolean getPostSortDateTime()
|
||||
{
|
||||
return postSortDateTime;
|
||||
}
|
||||
|
||||
public void setPostSortDateTime(boolean postSortDateTime)
|
||||
{
|
||||
this.postSortDateTime = postSortDateTime;
|
||||
}
|
||||
|
||||
protected abstract List<StoreRef> getAllStores();
|
||||
|
||||
|
@@ -209,7 +209,20 @@ public interface LuceneConfig
|
||||
* @return
|
||||
*/
|
||||
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
|
||||
* @return
|
||||
|
Reference in New Issue
Block a user