cqengine icon indicating copy to clipboard operation
cqengine copied to clipboard

Updating fields in objects

Open empirephoenix opened this issue 7 years ago • 2 comments

Hi,

I'm sorry to ask this via the Issuetracker, but I found no other way to ask a question about this project. What I kinda wonder about, how does the cqEngine knows if an index is not out of Date? Eg. the car example from the Readme, if I later on change the fields of the cars, is it detected, that the indices are not valid anymore? And if, how is this done?

empirephoenix avatar Apr 04 '17 11:04 empirephoenix

This is a good question, and it really should be documented better. I will interpret this issue as a request to improve the documentation, and I will keep it open until it's finally documented!

This question has come up before, and if you want to read the previous discussion you can see this thread in the discussion forum. (BTW you can ask questions in the forum, or this way via issues, I don't mind at all.)

Anyway, long story short - if you want to update an object, you need to use the update() method. This entails replacing an existing object in the collection, with a new version of it.

You can find some documentation on this in JavaDocs for TransactionalIndexedCollection.

You can also find an example of how to do replacements, in the examples folder, in particular here.

Hope that helps!

npgall avatar Apr 27 '17 20:04 npgall

(Leaving this open as a documentation task)

npgall avatar Apr 27 '17 20:04 npgall