lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael McCandless (JIRA)" <>
Subject [jira] Commented: (LUCENE-2320) Add MergePolicy to IndexWriterConfig
Date Wed, 17 Mar 2010 16:18:27 GMT


Michael McCandless commented on LUCENE-2320:

Patch looks good Shai!  I'd rather go with the SetOnce approach than introduce a single-use
factory for IW to create the MP.

But, I don't think we should keep the MP ctors that take IW?  Ie, you make the MP then call
.setIW on it?  We can just remove them (and advertise this in the CHANGES bw break entry)
since it's an experimental API...

> Add MergePolicy to IndexWriterConfig
> ------------------------------------
>                 Key: LUCENE-2320
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Index
>            Reporter: Shai Erera
>            Assignee: Michael McCandless
>             Fix For: 3.1
>         Attachments: LUCENE-2320.patch
> 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

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message