[
https://issues.apache.org/jira/browse/OAK-1874?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14027824#comment-14027824
]
Thomas Mueller commented on OAK-1874:
-------------------------------------
I'm not sure about the fix, I would have expected something like this (not
tested):
{noformat}
+ private boolean shouldReindex(NodeBuilder definition, NodeState before,
+ String name) {
+ PropertyState ps = definition.getProperty(REINDEX_PROPERTY_NAME);
+ if (ps != null && ps.getValue(BOOLEAN)) {
+ return true;
+ }
+ // in the case this is a new node, reindex in every case
+ // (don't thrust the reindex property)
+ return !before.getChildNode(INDEX_DEFINITIONS_NAME).hasChildNode(name);
+ }
{noformat}
Reason: if index definitions are exported and re-imported, the imported node
has the reindex property explicitly set to "false". So basically, this property
can't be always trusted.
Does it make sense?
The test would need to be modified as well.
> Indexes: re-index automatically when adding an index
> ----------------------------------------------------
>
> Key: OAK-1874
> URL: https://issues.apache.org/jira/browse/OAK-1874
> Project: Jackrabbit Oak
> Issue Type: Bug
> Components: query
> Reporter: Thomas Mueller
> Fix For: 1.0.1, 1.1
>
> Attachments: OAK-1874.patch
>
>
> When adding an index via import of content, the index is not automatically
> re-built. This is problematic, because subsequent queries will return no data
> because of that. Currently, the only way to re-index is to set the "reindex"
> property to "true".
> I suggest that indexes are automatically re-indexes if the hidden child node
> (":data" I believe) is missing. This is in addition to the "reindex" property.
--
This message was sent by Atlassian JIRA
(v6.2#6252)