document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. /**
  2.  * Construct an index in the given directory.
  3.  *
  4.  * @param indexDirectory
  5.  */
  6. private IndexInfo(File indexDirectory, LuceneConfig config){
  7.     /* ... */
  8.     if (version == 0){
  9.         /* ... */
  10.         if (IndexReader.indexExists(oldIndex)){
  11.             getWriteLock();
  12.             try{
  13.                 doWithFileLock(new LockWork<Object>(){
  14.                     public Object doWork() throws Exception{
  15.                         IndexWriter writer;
  16.                         try{
  17.                             writer = new IndexWriter(oldIndex, new AlfrescoStandardAnalyser(), false, MaxFieldLength.UNLIMITED);
  18. /* ... */
  19.    
  20. /**
  21.  * Make a lucene index writer
  22.  *
  23.  * @param location
  24.  * @param analyzer
  25.  * @return
  26.  * @throws IOException
  27.  */
  28. private IndexWriter makeDeltaIndexWriter(File location, Analyzer analyzer) throws IOException{
  29.     IndexWriter writer;
  30.     if (!IndexReader.indexExists(location)){
  31.         writer = new IndexWriter(location, analyzer, true, MaxFieldLength.UNLIMITED);
  32.     }else{
  33.         writer = new IndexWriter(location, analyzer, false, MaxFieldLength.UNLIMITED);
  34.     }
  35.     /* ... */
  36.         if (toMerge.size() > 0){
  37.             /* ... */
  38.             for (IndexEntry entry : toMerge.values()){
  39.                 /* ... */
  40.                 else if (entry.getStatus() == TransactionStatus.MERGE_TARGET){
  41.                     /* ... */
  42.                     if ((docCount < maxDocsForInMemoryMerge) && (mergeSize < maxRamInMbForInMemoryMerge)){
  43.                         ramDirectory = new RAMDirectory();
  44.                         writer = new IndexWriter(ramDirectory, new AlfrescoStandardAnalyser(), true, MaxFieldLength.UNLIMITED);
  45.                     }else{
  46.                         writer = new IndexWriter(location, new AlfrescoStandardAnalyser(), true, MaxFieldLength.UNLIMITED);
  47.                     }
  48. /* ... */
');