Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 335997

Summary: [Help][Search] Allow indexes created with Lucene 1.9.1 to be read
Product: [Eclipse Project] Platform Reporter: Chris Goldthorpe <cgold>
Component: User AssistanceAssignee: Chris Goldthorpe <cgold>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: P3 CC: cgold, eclipse
Version: 3.7   
Target Milestone: 3.7 M6   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Patch with tests none

Description Chris Goldthorpe CLA 2011-02-01 13:27:09 EST
+++ This bug was initially created as a clone of Bug #335144 +++

In Eclipse 3.7 M3, Lucene has been updated from 1.9.1 to 2.9.1 (see bug 248986). Only prebuilt indexes which have been built with the same Lucene version are used. 

... 

1.9.x prebuilt indexes seems to be compatible with a Lucene 2.x runtime. So we
can add in SearchIndex#isLuceneCompatible(String) before the last return:

    // Lucene 2.x can read 1.9.x indexes
    if (   version.getMajor() == 2
        && currentVersion.getMajor() == 1
        && currentVersion.getMinor() == 9) return true;

As a result of this Eclipse 3.7 would be able to read indexes built with
Eclipse 3.6 (or 3.5, 3.4, 3.3). I tested this with a very large 1.9.1 prebuilt
index: the prebuilt indexes were used (very fast indexing) and the search
results were correct, too.
Comment 1 Chris Goldthorpe CLA 2011-02-01 13:35:29 EST
Created attachment 188068 [details]
Patch with tests

Code to relax the dependency and add tests to verify that 1.9.1 and 2.9.1 prebuilt indexes can both load. The patch does not include to Lucene indexes added to the data directory in org.eclipse.ua.tests.
Comment 2 Chris Goldthorpe CLA 2011-02-01 13:36:53 EST
Patch committed to HEAD, Fixed
Comment 3 Holger Voormann CLA 2011-02-08 06:09:24 EST
(In reply to comment #2)
> Patch committed to HEAD, Fixed

Verified in N20110205-2000-win32. Thanks! :-)