You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by anson <an...@linkclub-staff.com> on 2007/07/10 10:17:58 UTC

How to use "point-in-time" feature

Hi,

I saw the new feature "point-in-time" on Lucene2.2.
If I upgrade my web-app from Lucene2.0 to Lucene2.2, I want to do that 
my web-app can access the INDEX over NFS , so what should I do to change 
my old web-app.

Could anyone show me some samples or your opinions.
(i.e. what difference on making index, searching between Lucene2.0 and 
Lucene2.2)

Best regards
Anson

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: How to use "point-in-time" feature

Posted by Michael McCandless <lu...@mikemccandless.com>.
In your application, can more than one machine be the writer?  If so,
there is at least one known active issue
(http://issues.apache.org/jira/browse/LUCENE-948) in Lucene 2.2 that
prevents this from working.

If instead the writer is always on a single machine, then it should
work, though please note that this area is not heavily tested yet!
Please report back if you move forward on this so we can gather data
points...

The thing you have to do is create a custom deletion policy, which is
just a class implementing this interface:

  http://lucene.apache.org/java/2_2_0/api/org/apache/lucene/index/IndexDeletionPolicy.html

You will need to implement your own application-dependent logic here
to tell the writer when it is safe to remove old commits.  For example
if you know all of your readers will check once per hour and re-init
themselves if the index has changed, then you would make a deletion
policy that removes any commits older than 1 hour.

The unit test for deletion policies (in the source distribution for
2.2) has several example deletion policies including one called
"ExpirationTimeDeletionPolicy" which implements the example above.

Once you've implemented such a class, then every time you open the
writer you must pass in an instance of your class and this will
prevent the writer from removing commit points (and the segments they
reference) that might be in use by your readers on other machines.

You can see gory details on current known status of Lucene over NFS
here:

  http://issues.apache.org/jira/browse/LUCENE-673

Mike

"anson" <an...@linkclub-staff.com> wrote:
> 
> Hi,
> 
> I saw the new feature "point-in-time" on Lucene2.2.
> If I upgrade my web-app from Lucene2.0 to Lucene2.2, I want to do that 
> my web-app can access the INDEX over NFS , so what should I do to change 
> my old web-app.
> 
> Could anyone show me some samples or your opinions.
> (i.e. what difference on making index, searching between Lucene2.0 and 
> Lucene2.2)
> 
> Best regards
> Anson
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org