• Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0-ALPHA
    • Component/s: core/index
    • Labels:
    • Lucene Fields:
      New, Patch Available


      Now that IndexWriterConfig is in place, I'd like to move MergePolicy to it as well. The change is not straightforward and so I've kept it for a separate issue. MergePolicy requires in its ctor an IndexWriter, however none can be passed to it before an IndexWriter actually exists. And today IW may create an MP just for it to be overridden by the application one line afterwards. I don't want to make iw member of MP non-final, or settable by extending classes, however it needs to remain protected so they can access it directly. So the proposed changes are:

      • Add a SetOnce object (to o.a.l.util), or Immutable, which can only be set once (hence its name). It'll have the signature SetOnce<T> w/ synchronized set<T> and T get(). T will be declared volatile, so that get() won't be synchronized.
      • MP will define a protected final SetOnce<IndexWriter> writer instead of the current writer. NOTE: this is a bw break. any suggestions are welcomed.
      • MP will offer a public default ctor, together with a set(IndexWriter).
      • IndexWriter will set itself on MP using set(this). Note that if set will be called more than once, it will throw an exception (AlreadySetException - or does someone have a better suggestion, preferably an already existing Java exception?).

      That's the core idea. I'd like to post a patch soon, so I'd appreciate your review and proposals.

      1. LUCENE-2320.patch
        130 kB
        Shai Erera
      2. LUCENE-2320.patch
        126 kB
        Shai Erera
      3. LUCENE-2320.patch
        127 kB
        Shai Erera
      4. LUCENE-2320.patch
        125 kB
        Shai Erera
      5. LUCENE-2320.patch
        109 kB
        Shai Erera


        Shai Erera created issue -
        Shai Erera made changes -
        Field Original Value New Value
        Attachment LUCENE-2320.patch [ 12438760 ]
        Shai Erera made changes -
        Lucene Fields [New] [New, Patch Available]
        Michael McCandless made changes -
        Assignee Michael McCandless [ mikemccand ]
        Shai Erera made changes -
        Attachment LUCENE-2320.patch [ 12439071 ]
        Shai Erera made changes -
        Attachment LUCENE-2320.patch [ 12439083 ]
        Shai Erera made changes -
        Attachment LUCENE-2320.patch [ 12439085 ]
        Shai Erera made changes -
        Attachment LUCENE-2320.patch [ 12439135 ]
        Michael McCandless made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Mark Thomas made changes -
        Workflow jira [ 12501771 ] Default workflow, editable Closed status [ 12564234 ]
        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12564234 ] jira [ 12584027 ]
        Uwe Schindler made changes -
        Status Resolved [ 5 ] Closed [ 6 ]


          • Assignee:
            Michael McCandless
            Shai Erera
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created: