re-indexing objects with lucene
I have a question still related to my objects in memory. I initialize the model as follows:
model.init("" +
"<root>" +
" <objA nb='5' attrA1='string(val1)' attrA2='int(0)'>" +
" <objB nb='8' attrB1='string(val2)' attrB2='int(102)' />" +
" <objQ nb='4' attrD3='int(250)' attrD6='string(ok)' />" +
" </objA>" +
" <objC nb='1' attrC1='int(1)'/>" +
" <objD nb='1' attrD1='string(valx)'/>" +
" <objZ nb='8' attrB1='string(val2)' attrB2='int(102)' />" +
" <objR nb='4' attrR1='string(val3)' />" +
" <mark nb='2' attrR9='string(valeur)'>" +
" <ttt name='string(qsa)'>" +
" <aaa></aaa>" +
" </ttt>" +
" </mark>" +
"</root>");
开发者_如何学编程 rootType = model.getRootType();
Then I index all the elements with their attributes; After that I modify some of them (I change the value of their attributes, I delete some objects, I create some news). How to detect that I modified the object and re-index it with lucene? I'll be really grateful for help.
How to detect that I modified the object
This is generally done by having a "modified" flag that is set to true
by all setters and set to false
whenever is's indexed.
and re-index it with lucene?
IIRC, Lucene cannot modify indexed documents, so you have to delete and re-add them.
精彩评论