You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by ch...@apache.org on 2015/09/09 10:40:07 UTC
svn commit: r1701948 - in /jackrabbit/oak/trunk/oak-lucene/src:
main/java/org/apache/jackrabbit/oak/plugins/index/lucene/
test/java/org/apache/jackrabbit/oak/plugins/index/lucene/
Author: chetanm
Date: Wed Sep 9 08:40:07 2015
New Revision: 1701948
URL: http://svn.apache.org/r1701948
Log:
OAK-3367 - Boosting fields not working as expected
Change the variable name to reflect the fact that all nodeScope and analyzed field would be used for the expanded query
Modified:
jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexDefinition.java
jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndex.java
jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexDefinitionTest.java
Modified: jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexDefinition.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexDefinition.java?rev=1701948&r1=1701947&r2=1701948&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexDefinition.java (original)
+++ jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexDefinition.java Wed Sep 9 08:40:07 2015
@@ -624,7 +624,7 @@ class IndexDefinition implements Aggrega
private final List<NamePattern> namePatterns;
private final List<PropertyDefinition> nullCheckEnabledProperties;
private final List<PropertyDefinition> notNullCheckEnabledProperties;
- private final List<PropertyDefinition> boostedProps;
+ private final List<PropertyDefinition> nodeScopeAnalyzedProps;
private final boolean indexesAllNodesOfMatchingType;
private final boolean nodeNameIndexed;
@@ -648,15 +648,15 @@ class IndexDefinition implements Aggrega
List<NamePattern> namePatterns = newArrayList();
List<PropertyDefinition> nonExistentProperties = newArrayList();
List<PropertyDefinition> existentProperties = newArrayList();
- List<PropertyDefinition> boostedProps = newArrayList();
+ List<PropertyDefinition> nodeScopeAnalyzedProps = newArrayList();
List<Aggregate.Include> propIncludes = newArrayList();
this.propConfigs = collectPropConfigs(config, namePatterns, propIncludes, nonExistentProperties,
- existentProperties, boostedProps);
+ existentProperties, nodeScopeAnalyzedProps);
this.propAggregate = new Aggregate(nodeTypeName, propIncludes);
this.aggregate = combine(propAggregate, nodeTypeName);
this.namePatterns = ImmutableList.copyOf(namePatterns);
- this.boostedProps = ImmutableList.copyOf(boostedProps);
+ this.nodeScopeAnalyzedProps = ImmutableList.copyOf(nodeScopeAnalyzedProps);
this.nullCheckEnabledProperties = ImmutableList.copyOf(nonExistentProperties);
this.notNullCheckEnabledProperties = ImmutableList.copyOf(existentProperties);
this.fulltextEnabled = aggregate.hasNodeAggregates() || hasAnyFullTextEnabledProperty();
@@ -685,7 +685,7 @@ class IndexDefinition implements Aggrega
this.propAggregate = original.propAggregate;
this.nullCheckEnabledProperties = original.nullCheckEnabledProperties;
this.notNullCheckEnabledProperties = original.notNullCheckEnabledProperties;
- this.boostedProps = original.boostedProps;
+ this.nodeScopeAnalyzedProps = original.nodeScopeAnalyzedProps;
this.aggregate = combine(propAggregate, nodeTypeName);
this.fulltextEnabled = aggregate.hasNodeAggregates() || original.fulltextEnabled;
this.indexesAllNodesOfMatchingType = allMatchingNodeByTypeIndexed();
@@ -722,8 +722,8 @@ class IndexDefinition implements Aggrega
return notNullCheckEnabledProperties;
}
- public List<PropertyDefinition> getBoostedProps() {
- return boostedProps;
+ public List<PropertyDefinition> getNodeScopeAnalyzedProps() {
+ return nodeScopeAnalyzedProps;
}
@Override
@@ -825,7 +825,7 @@ class IndexDefinition implements Aggrega
List<Aggregate.Include> propAggregate,
List<PropertyDefinition> nonExistentProperties,
List<PropertyDefinition> existentProperties,
- List<PropertyDefinition> boostedProps) {
+ List<PropertyDefinition> nodeScopeAnalyzedProps) {
Map<String, PropertyDefinition> propDefns = newHashMap();
NodeState propNode = config.getChildNode(LuceneIndexConstants.PROP_NODE);
@@ -867,7 +867,7 @@ class IndexDefinition implements Aggrega
if (pd.nodeScopeIndex
&& pd.analyzed
&& !pd.isRegexp){
- boostedProps.add(pd);
+ nodeScopeAnalyzedProps.add(pd);
}
}
}
Modified: jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndex.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndex.java?rev=1701948&r1=1701947&r2=1701948&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndex.java (original)
+++ jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndex.java Wed Sep 9 08:40:07 2015
@@ -1123,9 +1123,9 @@ public class LucenePropertyIndex impleme
private static Query tokenToQuery(String text, String fieldName, IndexingRule indexingRule, Analyzer analyzer) {
//Expand the query on fulltext field
if (FieldNames.FULLTEXT.equals(fieldName) &&
- !indexingRule.getBoostedProps().isEmpty()) {
+ !indexingRule.getNodeScopeAnalyzedProps().isEmpty()) {
BooleanQuery in = new BooleanQuery();
- for (PropertyDefinition pd : indexingRule.getBoostedProps()) {
+ for (PropertyDefinition pd : indexingRule.getNodeScopeAnalyzedProps()) {
Query q = tokenToQuery(text, FieldNames.createAnalyzedFieldName(pd.name), analyzer);
q.setBoost(pd.boost);
in.add(q, BooleanClause.Occur.SHOULD);
Modified: jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexDefinitionTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexDefinitionTest.java?rev=1701948&r1=1701947&r2=1701948&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexDefinitionTest.java (original)
+++ jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexDefinitionTest.java Wed Sep 9 08:40:07 2015
@@ -649,7 +649,7 @@ public class IndexDefinitionTest {
assertTrue("Analyzed should be assumed to be true for boosted fields", pd.analyzed);
assertFalse(rule1.getConfig("prop3").analyzed);
- assertEquals(2, rule1.getBoostedProps().size());
+ assertEquals(2, rule1.getNodeScopeAnalyzedProps().size());
}
//TODO indexesAllNodesOfMatchingType - with nullCheckEnabled