private boolean indexProperty()

in oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/spi/editor/FulltextDocumentMaker.java [244:333]


    private boolean indexProperty(String path,
                                  D doc,
                                  NodeState state,
                                  PropertyState property,
                                  String pname,
                                  PropertyDefinition pd) {
        boolean includeTypeForFullText = indexingRule.includePropertyType(property.getType().tag());

        boolean dirty = false;
        if (Type.BINARY.tag() == property.getType().tag() && pd.useInSimilarity) {
            try {
                if (definition.shouldIndexSimilarityBinaries()) {
                    log.trace("indexing similarity binaries for {}", pd.name);
                    indexSimilarityBinaries(doc, pd, property.getValue(Type.BINARY));
                    dirty = true;
                }
            } catch (Exception e) {
                log.error("could not index similarity field for property {} and definition {} for path {}",
                        property.getName(), pd, path);
            }
        } else if (Type.BINARY.tag() == property.getType().tag()
                && includeTypeForFullText) {
            List<String> binaryValues = newBinary(property, state, path + "@" + pname);
            addBinary(doc, null, binaryValues);
            dirty = true;
        } else {
            if (pd.propertyIndex && pd.includePropertyType(property.getType().tag())) {
                dirty |= addTypedFields(doc, property, pname, pd);
            }
            if (!definition.isDynamicBoostLiteEnabled() && pd.dynamicBoost) {
                try {
                    dirty |= indexDynamicBoost(doc, pname, pd.nodeName, state);
                } catch (Exception e) {
                    log.error("Could not index dynamic boost for property {} and definition {}", property, pd, e);
                }
            }

            if (pd.fulltextEnabled() && includeTypeForFullText) {
                for (String value : property.getValue(Type.STRINGS)) {
                    logLargeStringProperties(property.getName(), value);
                    if (definition.getPropertyRegex() != null && !definition.getPropertyRegex().matcher(value).find()) {
                        continue;
                    }
                    if (!includePropertyValue(value, pd)) {
                        continue;
                    }

                    if (pd.analyzed && pd.includePropertyType(property.getType().tag())) {
                        indexAnalyzedProperty(doc, pname, value, pd);
                    }

                    if (pd.useInSuggest) {
                        indexSuggestValue(doc, value);
                    }

                    if (pd.useInSpellcheck) {
                        indexSpellcheckValue(doc, value);
                    }

                    if (pd.nodeScopeIndex) {
                        if (isFulltextValuePersistedAtNode(pd)) {
                            indexFulltextValue(doc, value);
                        }
                        if (pd.useInSimilarity) {
                            log.trace("indexing similarity strings for {}", pd.name);
                            try {
                                // fallback for when feature vectors are written in string typed properties
                                if (definition.shouldIndexSimilarityStrings()) {
                                    indexSimilarityStrings(doc, pd, value);
                                }
                            } catch (Exception e) {
                                log.error("could not index similarity field for property {} and definition {} for path {}",
                                        property.getName(), pd, path);
                            }
                        }
                    }
                    dirty = true;
                }
            }
            if (pd.facet && isFacetingEnabled()) {
                dirty |= indexFacets(doc, property, pname, pd);
            }
            if (pd.similarityTags) {
                dirty |= indexSimilarityTag(doc, property);
            }

        }

        return dirty;
    }