Merged V2.0 to HEAD

5425: AR-1309
   5426: AR-1342
   5427: AWC-1157


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5480 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-04-11 21:46:19 +00:00
parent 529c4840e9
commit f43d8864cb
10 changed files with 203 additions and 27 deletions

View File

@@ -166,7 +166,8 @@ public class LuceneAnalyser extends Analyzer
// Temporary fix for person and user uids
if (propertyQName.equals(ContentModel.PROP_USER_USERNAME)
|| propertyQName.equals(ContentModel.PROP_USERNAME))
|| propertyQName.equals(ContentModel.PROP_USERNAME)
|| propertyQName.equals(ContentModel.PROP_AUTHORITY_NAME))
{
analyser = new VerbatimAnalyser(true);
}

View File

@@ -1745,8 +1745,8 @@ public class LuceneIndexerImpl2 extends LuceneBase2 implements LuceneIndexer2
}
else if (isText)
{
// Temporary special case for uids
if(propertyName.equals(ContentModel.PROP_USER_USERNAME) || propertyName.equals(ContentModel.PROP_USERNAME))
// Temporary special case for uids and gids
if(propertyName.equals(ContentModel.PROP_USER_USERNAME) || propertyName.equals(ContentModel.PROP_USERNAME) || propertyName.equals(ContentModel.PROP_AUTHORITY_NAME))
{
doc.add(new Field(attributeName, strValue, fieldStore, fieldIndex, Field.TermVector.NO));
}

View File

@@ -66,6 +66,8 @@ import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.MultiReader;
import org.apache.lucene.index.Term;
import org.apache.lucene.index.TermDocs;
import org.apache.lucene.index.TermEnum;
import org.apache.lucene.search.Hits;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Searcher;
@@ -442,10 +444,15 @@ public class IndexInfo
long docs = writer.docCount();
writer.close();
indexEntries.put(OLD_INDEX, new IndexEntry(IndexType.INDEX, OLD_INDEX, "",
TransactionStatus.COMMITTED, "", docs, 0, false));
IndexEntry entry = new IndexEntry(IndexType.INDEX, OLD_INDEX, "",
TransactionStatus.COMMITTED, "", docs, 0, false);
indexEntries.put(OLD_INDEX, entry);
writeStatus();
// The index exists and we should initialise the single reader
registerReferenceCountingIndexReader(entry.getName(),
buildReferenceCountingIndexReader(entry.getName()));
}
catch (IOException e)
{
@@ -2105,8 +2112,9 @@ public class IndexInfo
* Helper to print out index information
*
* @param args
* @throws Throwable
*/
public static void main(String[] args)
public static void main(String[] args) throws Throwable
{
String indexLocation = args[0];
@@ -2128,6 +2136,46 @@ public class IndexInfo
{
ii.releaseWriteLock();
}
IndexReader reader = ii.getMainIndexReferenceCountingReadOnlyIndexReader();
TermEnum terms = reader.terms(new Term("@{archiweb.model}instance", ""));
while(terms.next() && terms.term().field().equals("@{archiweb.model}instance"))
{
System.out.println("F = " +terms.term().field() + " V = "+terms.term().text() + " F = "+terms.docFreq());
}
terms.close();
long start = System.currentTimeMillis();
TermDocs termDocs = reader.termDocs(new Term("@{archiweb.model}instance", "tfl"));
while(termDocs.next())
{
//System.out.println("Doc = " + termDocs.doc());
Document doc = reader.document(termDocs.doc());
doc.getField("ID");
//System.out.println("Ref = "+doc.getField("ID"));
}
termDocs.close();
System.out.println("Time = "+((System.currentTimeMillis() - start)/1000.0f));
terms = reader.terms(new Term("TYPE", ""));
while(terms.next() && terms.term().field().equals("TYPE"))
{
System.out.println("F = " +terms.term().field() + " V = "+terms.term().text() + " F = "+terms.docFreq());
}
terms.close();
start = System.currentTimeMillis();
termDocs = reader.termDocs(new Term("TYPE","{archiweb.model}tfdoc"));
while(termDocs.next())
{
//System.out.println("Doc = " + termDocs.doc());
Document doc = reader.document(termDocs.doc());
doc.getField("ID");
//System.out.println("Ref = "+doc.getField("ID"));
}
termDocs.close();
System.out.println("Time = "+((System.currentTimeMillis() - start)/1000.0f));
//+@\{archiweb.model\}instance:TFL*
}
}