lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
Subject Re: IndexUpdateListener
Date Mon, 15 May 2006 04:09:33 GMT

: As deep as possible.
:
: All the user would need to know is Directory.getListerners()

I don't really get what the point of such a low level callback mechanism
would be ... do you have uses cases where you're really going to want to
know every time someone uses a Directory object to do something (create a
file, open a file, createa lock, etc..)

THe only usefull callback/listner abstractions i can think of are when you
want to know if someone has finished with a set of changes -- wether that
change is adding one document, deleting one document, or adding/deleting a
whole bunch of documents isn't really relevent, you still want to know
that a complete "set" has been modified, so you aren't constantly flushing
caches or reopening IndexReaders everytime a single document is added.

which means the lowerst level i can imagine a usefull listener hook being
added is hte IndexReader/IndexWriter/IndexModifier APIs -- but even then
what matters isn't the individual method calls, it's the opening and
closing of the objects themselves -- which means either subclassing them
so that when you construct them you tell them who to notify when they get
closed, or it means that you have some factory for creating them and that
factory keeps track of it ... Solr works in the later way.

Anyway I slice it, I can't think of any use cases where it would make
sense to register listeners as low as the IndexReader -- let alone down at
the directory.

Personally: I think the best way to be "notified" that the index is
changed at a really fine level of granularity is to just poll on
IndexReader.getCurrentVersion (and compare with IndexReader.getVersion)
... that way you don't have to worry that you'll get messages to often --
you can poll at whatever rate you want.



-Hoss


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


Mime
View raw message