[
https://issues.apache.org/jira/browse/OAK-2283?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Chetan Mehrotra resolved OAK-2283.
----------------------------------
Resolution: Fixed
Fix Version/s: (was: 1.2)
1.1.3
1.0.9
Fixed for {{LucenePropertyIndex}}.
> Fix inconsistent handling of includedPropertyTypes
> --------------------------------------------------
>
> Key: OAK-2283
> URL: https://issues.apache.org/jira/browse/OAK-2283
> Project: Jackrabbit Oak
> Issue Type: Sub-task
> Components: oak-lucene
> Reporter: Chetan Mehrotra
> Assignee: Chetan Mehrotra
> Priority: Minor
> Fix For: 1.0.9, 1.1.3
>
>
> Oak Lucene supports {{includePropertyTypes}} property which determines which
> all property types should be indexed. Its an array property whose would would
> be the names as defined in {{javax.jcr.PropertyType}}
> Current indexing logic has some inconsistent behaviour for default case when
> no explicit value is specified for this property. The propertyType
> restriction should support following cases
> # If no explicit propertyType is defined then all types should be included
> # It should be possible to define property type at property definition level
> also so as to distinguish properties based on type which share same name
> *Details*
> On indexing side
> [LuceneIndexEditor|https://svn.apache.org/repos/asf/jackrabbit/oak/tags/jackrabbit-oak-1.0.8/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditor.java]
> has following logic to determine if a property is to be included or not
> {code}
> if(context.isFullTextEnabled()
> && (context.getPropertyTypes() & (1 <<
> property.getType()
> .tag())) == 0){
> continue;
> }
> {code}
> The default value for {{propertyTypes}} is -1 as per [2]
> {code}
> PropertyState pst = defn.getProperty(INCLUDE_PROPERTY_TYPES);
> if (pst != null) {
> int types = 0;
> for (String inc : pst.getValue(Type.STRINGS)) {
> try {
> types |= 1 << PropertyType.valueFromName(inc);
> } catch (IllegalArgumentException e) {
> log.warn("Unknown property type: " + inc);
> }
> }
> this.propertyTypes = types;
> } else {
> this.propertyTypes = -1;
> }
> {code}
> Due to this in default case all properties would be indexed if no explicit
> value is set
> However on query side the inclusion rule uses following logic. Due to which
> per default config a value of -1 indicates that none of properties would be
> considered to be included
> {code:java}
> boolean includePropertyType(int type){
> if(propertyTypes < 0){
> return false;
> }
> return (propertyTypes & (1 << type)) != 0;
> }
> {code}
> [2]
> https://svn.apache.org/repos/asf/jackrabbit/oak/tags/jackrabbit-oak-1.0.8/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexDefinition.java
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)