You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Chetan Mehrotra (JIRA)" <ji...@apache.org> on 2015/06/17 12:48:01 UTC
[jira] [Commented] (OAK-2999) Index updation fails on updating
multivalued property
[ https://issues.apache.org/jira/browse/OAK-2999?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14589615#comment-14589615 ]
Chetan Mehrotra commented on OAK-2999:
--------------------------------------
Interesting issue!! {{LuceneIndexEditor}} only adds a Lucene Document for a node if there is a field created. In current case what happens is like this
# A node with a single MVP is created and indexed. Indexing logic checks for property -> Finds it indexable -> Loops over MVP -> create fields -> Lucene Document get created
# Later that MVP is set to empty. The change is detected by {{LuceneIndexEditor}} -> Finds it indexable -> Loops over the MVP -> No field gets created and hence no Document gets written. Due to this old Document does not get overwritten and continues to get shown in search result
As a fix the indexing logic should check if the property is indexable and create an empty Document if no field is created. Note that this should only be done the property (which is indexed) is change and previous state of property was not empty
> Index updation fails on updating multivalued property
> -----------------------------------------------------
>
> Key: OAK-2999
> URL: https://issues.apache.org/jira/browse/OAK-2999
> Project: Jackrabbit Oak
> Issue Type: Bug
> Components: lucene
> Affects Versions: 1.2, 1.0.15
> Reporter: Rishabh Maurya
> Assignee: Chetan Mehrotra
>
> On emptying a multivalued property, fulltext index updation fails and one can search on old values. Following test demonstrates the issue.
> Added below test in [LuceneIndexQueryTest.java|https://github.com/apache/jackrabbit-oak/blob/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexQueryTest.java] which should pass -
> {code}
> @Test
> public void testMultiValuedPropUpdate() throws Exception {
> Tree test = root.getTree("/").addChild("test");
> String child = "child";
> String mulValuedProp = "prop";
> test.addChild(child).setProperty(mulValuedProp, of("foo","bar"), Type.STRINGS);
> root.commit();
> assertQuery(
> "/jcr:root//*[jcr:contains(@" + mulValuedProp + ", 'foo')]",
> "xpath", ImmutableList.of("/test/" + child));
> test.getChild(child).setProperty(mulValuedProp, new ArrayList<String>(), Type.STRINGS);
> root.commit();
> assertQuery(
> "/jcr:root//*[jcr:contains(@" + mulValuedProp + ", 'foo')]",
> "xpath", new ArrayList<String>());
> test.getChild(child).setProperty(mulValuedProp, of("bar"), Type.STRINGS);
> root.commit();
> assertQuery(
> "/jcr:root//*[jcr:contains(@" + mulValuedProp + ", 'foo')]",
> "xpath", new ArrayList<String>());
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)