[英]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? 如何检测到我修改了对象并用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. 通常,通过将所有设置程序的“修饰”标志设置为true
并在对索引进行索引时将其设置为false
来完成此操作。
and re-index it with lucene? 并用lucene重新编制索引?
IIRC, Lucene cannot modify indexed documents, so you have to delete and re-add them. IIRC,Lucene无法修改索引文档,因此您必须删除并重新添加它们。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.