Looks like there is quite a handy way to push some meta data about the index (last index updated timestamp) via the following method:
IndexWriter.Commit(commitUserData)
What I am observing is that this works only if the commit contains at least one document instruction (add/delete or update), while in my case I would want to push user data even if I have no documents to update. I worked this around by always updating a “temp document”, but I feel dirty.
Any other way to do this better?
Using Lucene.NET 2.9.4.1.
Thanks!
The commit userdata map is used to persist informations about a commit, if there is nothing to commit, it makes sense for lucene to not store metadata. (There is no commit to relate the information to)
If the date you wanna store represents the last time you checked if the index needed an update (ie last crawl of a website), you should store this information elsewhere. (Database/config files/etc)
You could also use a combination of
FSDirectory.TouchFileFSDirectory.ListAllandFSDirectory.FileModifiedmethods, and use the lucene index file timestamps.http://lucene.apache.org/core/old_versioned_docs/versions/2_9_4/api/all/org/apache/lucene/store/FSDirectory.html