ExportXMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Normal
    • 2011-09-28
    • Affects Version/s: 2011-09-28
    • Component/s: None
    • None

      reloadIndex() is called when we have new indexes because it is quicker then initlizing from scratch, but if the reader has changed we don't appear to be closing the older reader

      Current Code:

       public void reloadIndex() throws CorruptIndexException, IOException {
          	
          	if (this.indexSearcher != null) {
          		IndexReader oldReader = indexSearcher.getIndexReader();
      			IndexReader newReader = oldReader.reopen();
      			if (oldReader != newReader) {
      				Similarity similarity = indexSearcher.getSimilarity();
      				this.indexSearcher = new IndexSearcher(newReader);
      				this.indexSearcher.setSimilarity(similarity);
      				this.setLastServerUpdatedDate();
      			}
          	}
          }
      

      New Code:

       public void reloadIndex() throws CorruptIndexException, IOException {
          	
          	if (this.indexSearcher != null) {
          		IndexReader oldReader = indexSearcher.getIndexReader();
      			IndexReader newReader = oldReader.reopen();
      			if (oldReader != newReader) {
      				Similarity similarity = indexSearcher.getSimilarity();
      				this.indexSearcher = new IndexSearcher(newReader);
      				this.indexSearcher.setSimilarity(similarity);
      				this.setLastServerUpdatedDate();
                                      indexSearcher.close();
      			}
          	}
          }
      

            Assignee:
            Paul Taylor
            Reporter:
            Paul Taylor
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                Version Package
                2011-09-28