thomasmueller commented on code in PR #3256:
URL: https://github.com/apache/jackrabbit-oak/pull/3256#discussion_r4439910035
##########
oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/IndexDefinition.java:
##########
@@ -1173,14 +1173,38 @@ public class IndexingRule {
/**
* Returns <code>true</code> if the property with the given name is
- * indexed according to this rule.
+ * indexed according to this rule. A property is considered indexed if
it
+ * has a property definition in this rule or if it is referenced by a
+ * function of this rule.
*
* @param propertyName the name of a property.
* @return <code>true</code> if the property is indexed;
* <code>false</code> otherwise.
*/
public boolean isIndexed(String propertyName) {
- return getConfig(propertyName) != null;
+ return getConfig(propertyName) != null ||
isFunctionIndexed(propertyName);
+ }
+
+ /**
+ * Returns <code>true</code> if the property with the given name is
referenced by a
+ * function of this rule and therefore participates in function-based
indexing.
+ *
+ * @param propertyName the name of a property.
+ * @return <code>true</code> if the property is referenced by a
function;
+ * <code>false</code> otherwise.
+ */
+ public boolean isFunctionIndexed(String propertyName) {
+ if (functionRestrictions.isEmpty()) {
+ return false;
+ }
+ for (PropertyDefinition pd : functionRestrictions) {
+ for (String referencedProperty :
FunctionIndexProcessor.getProperties(pd.functionCode)) {
+ if (referencedProperty.equalsIgnoreCase(propertyName)) {
Review Comment:
```suggestion
if (referencedProperty.equals(propertyName)) {
```
Property names are case sensitive (because this is after parsing), so
equalsIgnoreCase is actually incorrect. Well equalsIgnoreCase will not cause
bugs, but it would reindex in some (rare) cases unnecessarily.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]