mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Humongous merge. It is incomplete, however; faces-config-navigation.xml and ClientConfigElement
were both beyond me, and are just the raw conflict merge data. If Kev can't figure out how they should go together by tomorrow AM (for me) I'll dig back in. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4306 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -49,6 +49,9 @@ import org.alfresco.service.namespace.NamespacePrefixResolver;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.ISO9075;
|
||||
import org.alfresco.util.SearchLanguageConversion;
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
import org.apache.lucene.index.Term;
|
||||
import org.apache.lucene.index.TermEnum;
|
||||
import org.apache.lucene.search.Hits;
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.apache.lucene.search.Searcher;
|
||||
@@ -230,7 +233,7 @@ public class LuceneSearcherImpl2 extends LuceneBase2 implements LuceneSearcher2
|
||||
switch (sd.getSortType())
|
||||
{
|
||||
case FIELD:
|
||||
if (searcher.getReader().getFieldNames().contains(sd.getField()))
|
||||
if (fieldHasTerm(searcher.getReader(), sd.getField()))
|
||||
{
|
||||
fields[index++] = new SortField(sd.getField(), !sd.isAscending());
|
||||
}
|
||||
@@ -308,6 +311,35 @@ public class LuceneSearcherImpl2 extends LuceneBase2 implements LuceneSearcher2
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean fieldHasTerm(IndexReader indexReader, String field)
|
||||
{
|
||||
try
|
||||
{
|
||||
TermEnum termEnum = indexReader.terms(new Term(field, ""));
|
||||
try
|
||||
{
|
||||
if (termEnum.next())
|
||||
{
|
||||
Term first = termEnum.term();
|
||||
return first.field().equals(field);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
termEnum.close();
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
throw new SearcherException("Could not find terms for sort field ", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public ResultSet query(StoreRef store, String language, String query)
|
||||
{
|
||||
return query(store, language, query, null, null);
|
||||
|
@@ -834,8 +834,16 @@ public class IndexInfo
|
||||
// luceneIndexer.flushPending();
|
||||
|
||||
IndexReader deltaReader = buildAndRegisterDeltaReader(id);
|
||||
IndexReader reader = new MultiReader(new IndexReader[] {
|
||||
IndexReader reader = null;
|
||||
if (deletions == null || deletions.size() == 0)
|
||||
{
|
||||
reader = new MultiReader(new IndexReader[] {mainIndexReader, deltaReader });
|
||||
}
|
||||
else
|
||||
{
|
||||
reader = new MultiReader(new IndexReader[] {
|
||||
new FilterIndexReaderByNodeRefs2(mainIndexReader, deletions, deleteOnlyNodes), deltaReader });
|
||||
}
|
||||
reader = ReferenceCountingReadOnlyIndexReaderFactory.createReader("MainReader"+id, reader);
|
||||
ReferenceCounting refCounting = (ReferenceCounting)reader;
|
||||
refCounting.incrementReferenceCount();
|
||||
|
Reference in New Issue
Block a user