On 8/1/06, Andreas Hartmann <[EMAIL PROTECTED]> wrote:
> On 7/27/06, Andreas Hartmann <[EMAIL PROTECTED]> wrote:
>> Andreas Hartmann wrote:
>> > I'm currently writing a test which checks if the index has been
>> > updated when a document was changed.
>> >
>> > How can I do this from Java (do a search, or check the index for
>> > a certain document)?
>>
>> I guess the easiest way is to issue a search:
>>
>>    cocoon://modules/lucene/search.xml?queryString=...
>
> How about checking the last modified date of:
>    {pub}/work/search/lucene/index/live/index/segments
> ?  Check if it changes with an incremental update.

Thanks for the hint, but we shouldn't base our code on Lucene internals.
The code will break e.g. when a DB is used to store the index, or if it
is stored on a different machine. We would at least have to encapsulate
this and make it configurable, but I think there should be a more direct
way.

That is why we use APIs and Implementation classes?
...search.Search
...search.lucene.Lucene implements Search
getLastModifiedDate()

And publication.xconf configures which Search implementation to use
for the Publication?

You could use the Lucene's IndexReader's static function:
IndexReader.lastModified(Directory|File|String indexDirectory)
http://lucene.apache.org/java/docs/api/org/apache/lucene/index/IndexReader.html#lastModified(java.lang.String)

Again, the function is probably implementation specific, so it should
be wrapped.

solprovider

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to