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 to...@apache.org on 2018/09/19 09:00:17 UTC
svn commit: r1841303 - in
/jackrabbit/oak/trunk/oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search:
IndexDefinition.java spi/query/FulltextIndexPlanner.java
Author: tommaso
Date: Wed Sep 19 09:00:17 2018
New Revision: 1841303
URL: http://svn.apache.org/viewvc?rev=1841303&view=rev
Log:
OAK-3336 - fixed unresolved methods / constants
Modified:
jackrabbit/oak/trunk/oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/IndexDefinition.java
jackrabbit/oak/trunk/oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/spi/query/FulltextIndexPlanner.java
Modified: jackrabbit/oak/trunk/oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/IndexDefinition.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/IndexDefinition.java?rev=1841303&r1=1841302&r2=1841303&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/IndexDefinition.java (original)
+++ jackrabbit/oak/trunk/oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/IndexDefinition.java Wed Sep 19 09:00:17 2018
@@ -74,13 +74,13 @@ import static org.apache.jackrabbit.JcrC
import static org.apache.jackrabbit.JcrConstants.NT_BASE;
import static org.apache.jackrabbit.oak.api.Type.NAMES;
import static org.apache.jackrabbit.oak.commons.PathUtils.getParentPath;
-import static org.apache.jackrabbit.oak.plugins.index.search.FulltextIndexConstants.COMPAT_MODE;
-import static org.apache.jackrabbit.oak.plugins.index.search.FulltextIndexConstants.INDEX_DATA_CHILD_NAME;
import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.DECLARING_NODE_TYPES;
import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.ENTRY_COUNT_PROPERTY_NAME;
+import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.INDEXING_MODE_NRT;
import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.INDEXING_MODE_SYNC;
import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.REINDEX_COUNT;
import static org.apache.jackrabbit.oak.plugins.index.search.FulltextIndexConstants.BLOB_SIZE;
+import static org.apache.jackrabbit.oak.plugins.index.search.FulltextIndexConstants.COMPAT_MODE;
import static org.apache.jackrabbit.oak.plugins.index.search.FulltextIndexConstants.EVALUATE_PATH_RESTRICTION;
import static org.apache.jackrabbit.oak.plugins.index.search.FulltextIndexConstants.EXCLUDE_PROPERTY_NAMES;
import static org.apache.jackrabbit.oak.plugins.index.search.FulltextIndexConstants.EXPERIMENTAL_STORAGE;
@@ -89,9 +89,11 @@ import static org.apache.jackrabbit.oak.
import static org.apache.jackrabbit.oak.plugins.index.search.FulltextIndexConstants.FULL_TEXT_ENABLED;
import static org.apache.jackrabbit.oak.plugins.index.search.FulltextIndexConstants.INCLUDE_PROPERTY_NAMES;
import static org.apache.jackrabbit.oak.plugins.index.search.FulltextIndexConstants.INCLUDE_PROPERTY_TYPES;
+import static org.apache.jackrabbit.oak.plugins.index.search.FulltextIndexConstants.INDEX_DATA_CHILD_NAME;
import static org.apache.jackrabbit.oak.plugins.index.search.FulltextIndexConstants.ORDERED_PROP_NAMES;
import static org.apache.jackrabbit.oak.plugins.index.search.FulltextIndexConstants.PROP_FACETS_TOP_CHILDREN;
import static org.apache.jackrabbit.oak.plugins.index.search.FulltextIndexConstants.PROP_NODE;
+import static org.apache.jackrabbit.oak.plugins.index.search.FulltextIndexConstants.PROP_SECURE_FACETS;
import static org.apache.jackrabbit.oak.plugins.index.search.FulltextIndexConstants.TIKA;
import static org.apache.jackrabbit.oak.plugins.index.search.FulltextIndexConstants.TIKA_CONFIG;
import static org.apache.jackrabbit.oak.plugins.index.search.FulltextIndexConstants.TIKA_MAPPED_TYPE;
@@ -102,7 +104,10 @@ import static org.apache.jackrabbit.oak.
import static org.apache.jackrabbit.oak.spi.nodetype.NodeTypeConstants.JCR_NODE_TYPES;
import static org.apache.jackrabbit.oak.spi.nodetype.NodeTypeConstants.NODE_TYPES_PATH;
-public final class IndexDefinition implements Aggregate.AggregateMapper {
+/**
+ * Represents a configuration of an index.
+ */
+public class IndexDefinition implements Aggregate.AggregateMapper {
/**
* Name of the internal property that contains the child order defined in
* org.apache.jackrabbit.oak.plugins.tree.TreeConstants
@@ -122,19 +127,19 @@ public final class IndexDefinition imple
/**
* Default entry count to keep estimated entry count low.
*/
- static final long DEFAULT_ENTRY_COUNT = 1000;
+ public static final long DEFAULT_ENTRY_COUNT = 1000;
/**
* Default value for property {@link #maxFieldLength}.
*/
public static final int DEFAULT_MAX_FIELD_LENGTH = 10000;
- static final int DEFAULT_MAX_EXTRACT_LENGTH = -10;
+ public static final int DEFAULT_MAX_EXTRACT_LENGTH = -10;
/**
* System managed hidden property to record the current index version
*/
- static final String INDEX_VERSION = ":version";
+ public static final String INDEX_VERSION = ":version";
/**
* Hidden node under index definition which is used to store the index definition
@@ -159,7 +164,7 @@ public final class IndexDefinition imple
*/
public static final String PROP_UID = "uid";
- private static String TYPES_ALLOW_ALL_NAME = "all";
+ private static final String TYPES_ALLOW_ALL_NAME = "all";
static final int TYPES_ALLOW_NONE = PropertyType.UNDEFINED;
@@ -168,7 +173,7 @@ public final class IndexDefinition imple
/**
* Default suggesterUpdateFrequencyMinutes
*/
- static final int DEFAULT_SUGGESTER_UPDATE_FREQUENCY_MINUTES = 10;
+ public static final int DEFAULT_SUGGESTER_UPDATE_FREQUENCY_MINUTES = 10;
/**
* Default no. of facets retrieved
@@ -181,9 +186,9 @@ public final class IndexDefinition imple
public static final OrderEntry NATIVE_SORT_ORDER = new OrderEntry(JCR_SCORE, Type.UNDEFINED,
OrderEntry.Order.DESCENDING);
- private final boolean fullTextEnabled;
+ protected final boolean fullTextEnabled;
- private final NodeState definition;
+ protected final NodeState definition;
private final NodeState root;
@@ -239,6 +244,8 @@ public final class IndexDefinition imple
private final boolean suggestAnalyzed;
+ private final boolean secureFacets;
+
private final int numberOfTopFacets;
private final boolean suggestEnabled;
@@ -247,6 +254,7 @@ public final class IndexDefinition imple
private final String indexPath;
+ private final boolean nrtIndexMode;
private final boolean syncIndexMode;
private final boolean nodeTypeIndex;
@@ -261,14 +269,15 @@ public final class IndexDefinition imple
private final boolean testMode;
+ public boolean isTestMode() {
+ return testMode;
+ }
+
//~--------------------------------------------------------< Builder >
+ // TODO - this method should be removed after tests don't use it anymore
public static Builder newBuilder(NodeState root, NodeState defn, String indexPath){
- return new Builder(root, defn, indexPath);
- }
-
- public boolean isTestMode() {
- return false;
+ return new Builder().root(root).defn(defn).indexPath(indexPath);
}
public static class Builder {
@@ -277,17 +286,26 @@ public final class IndexDefinition imple
* and index is not populated
*/
private static final String DEFAULT_UID = "0";
- private final NodeState root;
- private final NodeState defn;
- private final String indexPath;
- private String uid;
+ protected NodeState root;
+ private NodeState defn;
+ protected String indexPath;
+ protected String uid;
private boolean reindexMode;
- private IndexFormatVersion version;
+ protected IndexFormatVersion version;
- public Builder(NodeState root, NodeState defn, String indexPath) {
+ public Builder root(NodeState root) {
this.root = checkNotNull(root);
+ return this;
+ }
+
+ public Builder defn(NodeState defn) {
this.defn = checkNotNull(defn);
+ return this;
+ }
+
+ public Builder indexPath(String indexPath) {
this.indexPath = checkNotNull(indexPath);
+ return this;
}
public Builder uid(String uid){
@@ -321,6 +339,11 @@ public final class IndexDefinition imple
if (!reindexMode){
indexDefnStateToUse = getIndexDefinitionState(defn);
}
+ return createInstance(indexDefnStateToUse);
+ }
+
+ // TODO: This method should be abstract... to be done later after tests are updated so that they compile
+ protected IndexDefinition createInstance(NodeState indexDefnStateToUse) {
return new IndexDefinition(root, indexDefnStateToUse, version, uid, indexPath);
}
}
@@ -329,7 +352,7 @@ public final class IndexDefinition imple
this(root, getIndexDefinitionState(defn), determineIndexFormatVersion(defn), determineUniqueId(defn), indexPath);
}
- private IndexDefinition(NodeState root, NodeState defn, IndexFormatVersion version, String uid, String indexPath) {
+ protected IndexDefinition(NodeState root, NodeState defn, IndexFormatVersion version, String uid, String indexPath) {
this.root = root;
this.version = checkNotNull(version);
this.uid = uid;
@@ -358,7 +381,7 @@ public final class IndexDefinition imple
String functionName = getOptionalValue(defn, FulltextIndexConstants.FUNC_NAME, null);
if (fullTextEnabled && functionName == null){
- functionName = "fulltext";
+ functionName = getDefaultFunctionName();
}
this.funcName = functionName != null ? "native*" + functionName : null;
@@ -371,7 +394,7 @@ public final class IndexDefinition imple
}
this.maxFieldLength = getOptionalValue(defn, FulltextIndexConstants.MAX_FIELD_LENGTH, DEFAULT_MAX_FIELD_LENGTH);
- this.costPerEntry = getOptionalValue(defn, FulltextIndexConstants.COST_PER_ENTRY, 1.0);
+ this.costPerEntry = getOptionalValue(defn, FulltextIndexConstants.COST_PER_ENTRY, getDefaultCostPerEntry(version));
this.costPerExecution = getOptionalValue(defn, FulltextIndexConstants.COST_PER_EXECUTION, 1.0);
this.hasCustomTikaConfig = getTikaConfigNode().exists();
this.customTikaMimeTypeMappings = buildMimeTypeMap(definition.getChildNode(TIKA).getChildNode(TIKA_MIME_TYPES));
@@ -386,13 +409,16 @@ public final class IndexDefinition imple
if (defn.hasChildNode(FACETS)) {
NodeState facetsConfig = defn.getChildNode(FACETS);
+ this.secureFacets = getOptionalValue(facetsConfig, PROP_SECURE_FACETS, true);
this.numberOfTopFacets = getOptionalValue(facetsConfig, PROP_FACETS_TOP_CHILDREN, DEFAULT_FACET_COUNT);
} else {
+ this.secureFacets = true;
this.numberOfTopFacets = DEFAULT_FACET_COUNT;
}
this.suggestEnabled = evaluateSuggestionEnabled();
this.spellcheckEnabled = evaluateSpellcheckEnabled();
+ this.nrtIndexMode = supportsNRTIndexing(defn);
this.syncIndexMode = supportsSyncIndexing(defn);
this.syncPropertyIndexes = definedRules.stream().anyMatch(ir -> !ir.syncProps.isEmpty());
}
@@ -409,6 +435,11 @@ public final class IndexDefinition imple
return funcName;
}
+ //TODO Should this method be abstract?
+ protected String getDefaultFunctionName() {
+ return "fulltext";//TODO Should this be FulltextIndexConstants.FUNC_NAME
+ }
+
public boolean hasFunctionDefined(){
return funcName != null;
}
@@ -452,6 +483,10 @@ public final class IndexDefinition imple
return costPerEntry;
}
+ protected double getDefaultCostPerEntry(IndexFormatVersion version) {
+ return 1.0;
+ }
+
public double getCostPerExecution() {
return costPerExecution;
}
@@ -518,6 +553,10 @@ public final class IndexDefinition imple
return uid;
}
+ public boolean isNRTIndexingEnabled() {
+ return nrtIndexMode;
+ }
+
public boolean isSyncIndexingEnabled() {
return syncIndexMode;
}
@@ -588,7 +627,7 @@ public final class IndexDefinition imple
@Nullable
public Aggregate getAggregate(String nodeType){
Aggregate agg = aggregates.get(nodeType);
- return agg != null ? agg : null;
+ return agg;
}
private Map<String, Aggregate> collectAggregates(NodeState defn) {
@@ -810,6 +849,10 @@ public final class IndexDefinition imple
return suggestAnalyzed;
}
+ public boolean isSecureFacets() {
+ return secureFacets;
+ }
+
public int getNumberOfTopFacets() {
return numberOfTopFacets;
}
@@ -827,12 +870,13 @@ public final class IndexDefinition imple
private final List<PropertyDefinition> notNullCheckEnabledProperties;
private final List<PropertyDefinition> nodeScopeAnalyzedProps;
private final List<PropertyDefinition> syncProps;
+ private final List<PropertyDefinition> similarityProperties;
private final boolean indexesAllNodesOfMatchingType;
private final boolean nodeNameIndexed;
- final float boost;
+ public final float boost;
final boolean inherited;
- final int propertyTypes;
+ public final int propertyTypes;
final boolean fulltextEnabled;
public final boolean propertyIndexEnabled;
final boolean nodeFullTextIndexed;
@@ -840,7 +884,6 @@ public final class IndexDefinition imple
final Aggregate aggregate;
final Aggregate propAggregate;
-
IndexingRule(String nodeTypeName, NodeState config) {
this.nodeTypeName = nodeTypeName;
this.baseNodeType = nodeTypeName;
@@ -854,9 +897,10 @@ public final class IndexDefinition imple
List<PropertyDefinition> existentProperties = newArrayList();
List<PropertyDefinition> nodeScopeAnalyzedProps = newArrayList();
List<PropertyDefinition> syncProps = newArrayList();
+ List<PropertyDefinition> similarityProperties = newArrayList();
List<Aggregate.Include> propIncludes = newArrayList();
this.propConfigs = collectPropConfigs(config, namePatterns, propIncludes, nonExistentProperties,
- existentProperties, nodeScopeAnalyzedProps, functionRestrictions, syncProps);
+ existentProperties, nodeScopeAnalyzedProps, functionRestrictions, syncProps, similarityProperties);
this.propAggregate = new Aggregate(nodeTypeName, propIncludes);
this.aggregate = combine(propAggregate, nodeTypeName);
@@ -865,6 +909,7 @@ public final class IndexDefinition imple
this.nullCheckEnabledProperties = ImmutableList.copyOf(nonExistentProperties);
this.functionRestrictions = ImmutableList.copyOf(functionRestrictions);
this.notNullCheckEnabledProperties = ImmutableList.copyOf(existentProperties);
+ this.similarityProperties = ImmutableList.copyOf(similarityProperties);
this.fulltextEnabled = aggregate.hasNodeAggregates() || hasAnyFullTextEnabledProperty();
this.nodeFullTextIndexed = aggregate.hasNodeAggregates() || anyNodeScopeIndexedProperty();
this.propertyIndexEnabled = hasAnyPropertyIndexConfigured();
@@ -901,6 +946,7 @@ public final class IndexDefinition imple
this.indexesAllNodesOfMatchingType = areAlMatchingNodeByTypeIndexed();
this.nodeNameIndexed = original.nodeNameIndexed;
this.syncProps = original.syncProps;
+ this.similarityProperties = original.similarityProperties;
}
/**
@@ -948,6 +994,10 @@ public final class IndexDefinition imple
return nodeScopeAnalyzedProps;
}
+ public List<PropertyDefinition> getSimilarityProperties() {
+ return similarityProperties;
+ }
+
@Override
public String toString() {
String str = "IndexRule: "+ nodeTypeName;
@@ -976,22 +1026,11 @@ public final class IndexDefinition imple
}
}
- if (!nodeTypeName.equals(getPrimaryTypeName(state))) {
- return false;
- }
- //TODO Add support for condition
- //return condition == null || condition.evaluate(state);
- return true;
+ return nodeTypeName.equals(getPrimaryTypeName(state));
}
public boolean appliesTo(String nodeTypeName) {
- if (!this.nodeTypeName.equals(nodeTypeName)) {
- return false;
- }
-
- //TODO Once condition support is done return false
- //return condition == null || condition.evaluate(state);
- return true;
+ return this.nodeTypeName.equals(nodeTypeName);
}
@@ -1069,13 +1108,14 @@ public final class IndexDefinition imple
List<PropertyDefinition> existentProperties,
List<PropertyDefinition> nodeScopeAnalyzedProps,
List<PropertyDefinition> functionRestrictions,
- List<PropertyDefinition> syncProps) {
+ List<PropertyDefinition> syncProps,
+ List<PropertyDefinition> similarityProperties) {
Map<String, PropertyDefinition> propDefns = newHashMap();
NodeState propNode = config.getChildNode(FulltextIndexConstants.PROP_NODE);
if (propNode.exists() && !hasOrderableChildren(propNode)){
log.warn("Properties node for [{}] does not have orderable " +
- "children in [{}]", this, IndexDefinition.this);
+ "children in [{}]", this, IndexDefinition.this);
}
//In case of a pure nodetype index we just index primaryType and mixins
@@ -1140,14 +1180,17 @@ public final class IndexDefinition imple
//Include props with name, boosted and nodeScopeIndex
if (pd.nodeScopeIndex
- && pd.analyzed
- && !pd.isRegexp){
+ && pd.analyzed
+ && !pd.isRegexp){
nodeScopeAnalyzedProps.add(pd);
}
if (pd.sync) {
syncProps.add(pd);
}
+ if (pd.useInSimilarity) {
+ similarityProperties.add(pd);
+ }
}
}
ensureNodeTypeIndexingIsConsistent(propDefns, syncProps);
@@ -1239,11 +1282,8 @@ public final class IndexDefinition imple
//jcr:primaryType is present on all node. So if such a property
//is indexed then it would mean all nodes covered by this index rule
//are indexed
- if (getConfig(JcrConstants.JCR_PRIMARYTYPE) != null){
- return true;
- }
+ return getConfig(JcrConstants.JCR_PRIMARYTYPE) != null;
- return false;
}
private boolean evaluateNodeNameIndexed(NodeState config) {
@@ -1606,7 +1646,7 @@ public final class IndexDefinition imple
nb.setProperty(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED, Type.NAME);
}
- private static IndexFormatVersion determineIndexFormatVersion(NodeState defn) {
+ protected static IndexFormatVersion determineIndexFormatVersion(NodeState defn) {
//Compat mode version if specified has highest priority
if (defn.hasProperty(COMPAT_MODE)){
return versionFrom(defn.getProperty(COMPAT_MODE));
@@ -1662,7 +1702,7 @@ public final class IndexDefinition imple
//Check if fulltext is false which indicates its a property index and
//hence confirm to V2 or above
if (fulltext != null && !fulltext.getValue(Type.BOOLEAN)){
- return IndexFormatVersion.max(result,IndexFormatVersion.V2);
+ return IndexFormatVersion.max(result, IndexFormatVersion.V2);
}
return result;
@@ -1685,14 +1725,22 @@ public final class IndexDefinition imple
}
@Nullable
- private static String determineUniqueId(NodeState defn) {
+ protected static String determineUniqueId(NodeState defn) {
return defn.getChildNode(STATUS_NODE).getString(PROP_UID);
}
+ private static boolean supportsNRTIndexing(NodeState defn) {
+ return supportsIndexingMode(new ReadOnlyBuilder(defn), INDEXING_MODE_NRT);
+ }
+
private static boolean supportsSyncIndexing(NodeState defn) {
return supportsIndexingMode(new ReadOnlyBuilder(defn), INDEXING_MODE_SYNC);
}
+ public static boolean supportsSyncOrNRTIndexing(NodeBuilder defn) {
+ return supportsIndexingMode(defn, INDEXING_MODE_NRT) || supportsIndexingMode(defn, INDEXING_MODE_SYNC);
+ }
+
private static boolean supportsIndexingMode(NodeBuilder defn, String mode) {
PropertyState async = defn.getProperty(IndexConstants.ASYNC_PROPERTY_NAME);
if (async == null){
@@ -1701,7 +1749,7 @@ public final class IndexDefinition imple
return Iterables.contains(async.getValue(Type.STRINGS), mode);
}
- private static NodeState getIndexDefinitionState(NodeState defn) {
+ protected static NodeState getIndexDefinitionState(NodeState defn) {
if (isDisableStoredIndexDefinition()){
return defn;
}
Modified: jackrabbit/oak/trunk/oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/spi/query/FulltextIndexPlanner.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/spi/query/FulltextIndexPlanner.java?rev=1841303&r1=1841302&r2=1841303&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/spi/query/FulltextIndexPlanner.java (original)
+++ jackrabbit/oak/trunk/oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/spi/query/FulltextIndexPlanner.java Wed Sep 19 09:00:17 2018
@@ -52,7 +52,6 @@ import org.apache.jackrabbit.oak.spi.que
import org.apache.jackrabbit.oak.spi.query.fulltext.FullTextTerm;
import org.apache.jackrabbit.oak.spi.query.fulltext.FullTextVisitor;
import org.jetbrains.annotations.Nullable;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -70,6 +69,9 @@ import static org.apache.jackrabbit.oak.
public class FulltextIndexPlanner {
+ public static final int DEFAULT_PROPERTY_WEIGHT = Integer.getInteger("oak.fulltext.defaultPropertyWeight", 5);
+
+
/**
* IndexPaln Attribute name which refers to the name of the fields that should be used for facets.
*/
@@ -83,7 +85,7 @@ public class FulltextIndexPlanner {
private final List<OrderEntry> sortOrder;
private IndexNode indexNode;
private PlanResult result;
- private static boolean useActualEntryCount = false;
+ protected static boolean useActualEntryCount;
static {
useActualEntryCount = Boolean.parseBoolean(System.getProperty(FLAG_ENTRY_COUNT, "true"));
@@ -103,7 +105,7 @@ public class FulltextIndexPlanner {
this.sortOrder = sortOrder;
}
- IndexPlan getPlan() {
+ public IndexPlan getPlan() {
IndexPlan.Builder builder = getPlanBuilder();
if (definition.isTestMode()){
@@ -133,8 +135,10 @@ public class FulltextIndexPlanner {
'}';
}
- //For tests
- static void setUseActualEntryCount(boolean useActualEntryCount) {
+ //For tests and since the property is anyway controllable by JVM param, so
+ //public isn't very bad. Though, the real need to use 'public' is because
+ //tests not in this package (happy to hear about other options)
+ public static void setUseActualEntryCount(boolean useActualEntryCount) {
FulltextIndexPlanner.useActualEntryCount = useActualEntryCount;
}
@@ -323,16 +327,11 @@ public class FulltextIndexPlanner {
// that doesn't match everything
// case of like search
String prefix = ValuePatternUtil.getLongestPrefix(filter, pr.propertyName);
- if (!pd.valuePattern.matchesPrefix(prefix)) {
- // region match which is not fully in the pattern
- return false;
- }
+ return pd.valuePattern.matchesPrefix(prefix);
} else {
// we have a value pattern, for example (a|b),
// but we search (also) for 'c': can't match
- if (!pd.valuePattern.matchesAll(values)) {
- return false;
- }
+ return pd.valuePattern.matchesAll(values);
}
}
return true;
@@ -444,12 +443,8 @@ public class FulltextIndexPlanner {
}
// If jcr:score is the only sort order then opt out
- if (sortOrder.size() == 1 &&
- JCR_SCORE.equals(sortOrder.get(0).getPropertyName())) {
- return false;
- }
-
- return true;
+ return sortOrder.size() != 1 ||
+ !JCR_SCORE.equals(sortOrder.get(0).getPropertyName());
}
private boolean canEvalAllFullText(final IndexingRule indexingRule, FullTextExpression ft) {
@@ -918,9 +913,9 @@ public class FulltextIndexPlanner {
//~--------------------------------------------------------< PlanResult >
public static class PlanResult {
- final String indexPath;
- final IndexDefinition indexDefinition;
- final IndexDefinition.IndexingRule indexingRule;
+ public final String indexPath;
+ public final IndexDefinition indexDefinition;
+ public final IndexDefinition.IndexingRule indexingRule;
private final List<PropertyDefinition> sortedProperties = newArrayList();
//Map of actual property name as present in our property definitions
@@ -1049,8 +1044,8 @@ public class FulltextIndexPlanner {
}
public static class PropertyIndexResult {
- final String propertyName;
- final PropertyRestriction pr;
+ public final String propertyName;
+ public final PropertyRestriction pr;
public PropertyIndexResult(String propertyName, PropertyRestriction pr) {
this.propertyName = propertyName;