简体   繁体   中英

lucene indexing objects in memory

I'm just stuck with one problem and don't know how to figure it out. I'm working on the indexation of the objects that are in computer memory (they exist only in my java code). Don't have any problems with indexing it, however I have no idea how to re-index it if they change during the execution of this code; one of my ideas is adding some events to this objects (if you change any parameters -> reindex it ). However I'm not sure about its efficiency? Thank you in advance Daniel

Lucene is already very efficient when writing to a disk index. If you have objects already in memory, you have less work to do than usual (read the objects from disk is the typical scenario), so reindexing will not usually be a problem. You just have to delete the object and index it again (in IndexWriter ).

You did not specify this, but if your index needs not to be persistent, then you can do all in memory, so it will be much faster, see RAMDirectory and MemoryIndex

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM