/**
* Construct an index in the given directory.
*
* @param indexDirectory
*/
private IndexInfo(File indexDirectory, LuceneConfig config){
/* ... */
if (version == 0){
/* ... */
if (IndexReader.indexExists(oldIndex)){
getWriteLock();
try{
doWithFileLock(new LockWork<Object>(){
public Object doWork() throws Exception{
IndexWriter writer;
try{
writer = new IndexWriter(oldIndex, new AlfrescoStandardAnalyser(), false, MaxFieldLength.UNLIMITED);
/* ... */
/**
* Make a lucene index writer
*
* @param location
* @param analyzer
* @return
* @throws IOException
*/
private IndexWriter makeDeltaIndexWriter(File location, Analyzer analyzer) throws IOException{
IndexWriter writer;
if (!IndexReader.indexExists(location)){
writer = new IndexWriter(location, analyzer, true, MaxFieldLength.UNLIMITED);
}else{
writer = new IndexWriter(location, analyzer, false, MaxFieldLength.UNLIMITED);
}
/* ... */
if (toMerge.size() > 0){
/* ... */
for (IndexEntry entry : toMerge.values()){
/* ... */
else if (entry.getStatus() == TransactionStatus.MERGE_TARGET){
/* ... */
if ((docCount < maxDocsForInMemoryMerge) && (mergeSize < maxRamInMbForInMemoryMerge)){
ramDirectory = new RAMDirectory();
writer = new IndexWriter(ramDirectory, new AlfrescoStandardAnalyser(), true, MaxFieldLength.UNLIMITED);
}else{
writer = new IndexWriter(location, new AlfrescoStandardAnalyser(), true, MaxFieldLength.UNLIMITED);
}
/* ... */