[ 
https://issues.apache.org/jira/browse/OAK-3591?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15006298#comment-15006298
 ] 

Chetan Mehrotra commented on OAK-3591:
--------------------------------------

Fixed this with 1714520 in trunk

The issue was that {{fulltextEnabled}} was covering 2 cases either some 
property is having analyzed=true or nodeScopeIndex= true. IndexPlanner was 
relying on {{fulltextEnabled}} to decide if it should answer a fulltext query. 
Here it did not considered the case that fulltext query can be nodeScoped and 
there might be no nodeScoped property

As a fix now a new property {{nodeFullTextIndexed}} is introduced in 
{{IndexingRule}}. This would be true only if a fulltext field for node would be 
created due to either aggregation or some property having nodeScopeIndex=true. 
{{indexPlanner}} would now use that to determine if it can handle query like 
_contains(., 'foo')_. So if only {{analyzed}} is true then such query would not 
be handled.

A similar case was coming when indexRule is for nt:base and some property had 
analyzed=true. In such a case {{indexesAllNodesOfMatchingType}} was being 
calculated as true as it relied on {{fulltextEnabled}} to determine if all node 
matching given rule would be indexed or not. And in such a case planner would 
think it can answer the query  like _/jcr:root//element(*, nt:file)_ as it 
think that all nodes of type nt:file would be indexed given nt:file > nt:base. 
Now  {{indexesAllNodesOfMatchingType}} is determined on basis of 
{{nodeFullTextIndexed}} as in only that case all nodes matching given rule 
would be indexed irrespective if any specific property is present or not

With this change also modified to {{PropertyDefinition}} to treat all config to 
be false if {{index}} is false

> Lucene index with 'analyzed=true' sometimes used by mistake
> -----------------------------------------------------------
>
>                 Key: OAK-3591
>                 URL: https://issues.apache.org/jira/browse/OAK-3591
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: lucene, query
>            Reporter: Thomas Mueller
>            Assignee: Chetan Mehrotra
>             Fix For: 1.3.11
>
>
> A Lucene index with a property that is configured as "analyzed = true" is 
> sometimes used by mistake. Example:
> {noformat}
> oak:index/testLuceneIndex (oak:QueryIndexDefinition)
>   compatVersion: 2
>   type: lucene
>   async: "async"
>   indexRules (nt:unstructured)
>     nt:base (nt:unstructured)
>       properties (nt:unstructured)
>         xyz (nt:unstructured)
>           propertyIndex: true,
>           analyzed: true,
>           name: xyz
> query:
> /jcr:root/content//*[jcr:contains(., '1234')]
> {noformat}
> The index is used, but the result does not contain nodes with properties abc 
> = '1234'.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to