public OakSolrConfiguration getConfiguration()

in oak-solr-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/osgi/OakSolrConfigurationProviderService.java [166:307]


    public OakSolrConfiguration getConfiguration() {
        if (oakSolrConfiguration == null) {
            oakSolrConfiguration = new OakSolrConfiguration() {

                @Override
                public String getFieldNameFor(Type<?> propertyType) {
                    for (String typeMapping : typeMappings) {
                        String[] mapping = typeMapping.split("=");
                        if (mapping.length == 2 && mapping[0] != null && mapping[1] != null) {
                            Type<?> type = Type.fromString(mapping[0]);
                            if (type != null && type.tag() == propertyType.tag()) {
                                return mapping[1];
                            }
                        }
                    }
                    return null;
                }

                @Override
                public String getFieldForPropertyRestriction(Filter.PropertyRestriction propertyRestriction) {
                    for (String propertyMapping : propertyMappings) {
                        String[] mapping = propertyMapping.split("=");
                        if (mapping.length == 2 && mapping[0] != null && mapping[1] != null) {
                            if (mapping[0].equals(propertyRestriction.propertyName)) {
                                return mapping[1];
                            }
                        }
                    }
                    return null;
                }

                @NotNull
                @Override
                public String getPathField() {
                    return pathExactFieldName;
                }

                @Nullable
                @Override
                public String getFieldForPathRestriction(Filter.PathRestriction pathRestriction) {
                    String fieldName = null;
                    switch (pathRestriction) {
                        case ALL_CHILDREN: {
                            fieldName = pathDescendantsFieldName;
                            break;
                        }
                        case DIRECT_CHILDREN: {
                            fieldName = pathChildrenFieldName;
                            break;
                        }
                        case EXACT: {
                            fieldName = pathExactFieldName;
                            break;
                        }
                        case PARENT: {
                            fieldName = pathParentFieldName;
                            break;
                        }
                        case NO_RESTRICTION:
                            break;
                        default:
                            break;

                    }
                    return fieldName;
                }

                @NotNull
                @Override
                public CommitPolicy getCommitPolicy() {
                    return commitPolicy;
                }

                @Override
                public String getCatchAllField() {
                    return catchAllField;
                }

                @Override
                public int getRows() {
                    return rows;
                }

                @Override
                public boolean useForPropertyRestrictions() {
                    return useForPropertyRestrictions;
                }

                @Override
                public boolean useForPrimaryTypes() {
                    return useForPrimaryTypes;
                }

                @Override
                public boolean useForPathRestrictions() {
                    return useForPathRestrictions;
                }

                @NotNull
                @Override
                public Collection<String> getIgnoredProperties() {
                    if (ignoredProperties != null && ignoredProperties.length > 0 && ignoredProperties[0].length() > 0) {
                        return Arrays.asList(ignoredProperties);
                    } else {
                        return Collections.emptyList();
                    }
                }

                @NotNull
                @Override
                public Collection<String> getUsedProperties() {
                    if (usedProperties != null && usedProperties.length > 0 && usedProperties[0].length() > 0) {
                        return Arrays.asList(usedProperties);
                    } else {
                        return Collections.emptyList();
                    }
                }

                @Override
                public boolean collapseJcrContentNodes() {
                    return collapseJcrContentNodes;
                }

                @Override
                public boolean collapseJcrContentParents() {
                    return collapseJcrContentParents;
                }

                @NotNull
                @Override
                public String getCollapsedPathField() {
                    return collapsedPathField;
                }

                @Override
                public String getPathDepthField() {
                    return depthField;
                }
            };
        }
        return oakSolrConfiguration;
    }