use of com.enonic.xp.index.IndexConfig in project xp by enonic.
the class IndexItemFactory method createItems.
private static List<IndexItem> createItems(final IndexPath indexPath, final IndexConfigDocument indexConfigDocument, final Value processedPropertyValue) {
final List<IndexItem> items = new ArrayList<>();
final IndexConfig indexConfig = indexConfigDocument.getConfigForPath(indexPath);
if (indexConfig.isEnabled()) {
items.addAll(BaseTypeFactory.create(indexPath, processedPropertyValue));
items.addAll(FulltextTypeFactory.create(indexPath, processedPropertyValue, indexConfig));
items.add(OrderByTypeFactory.create(indexPath, processedPropertyValue));
items.addAll(AllTextTypeFactory.create(processedPropertyValue, indexConfig, indexConfigDocument.getAllTextConfig()));
items.addAll(StemmedTypeFactory.create(indexPath, processedPropertyValue, indexConfig));
if (indexConfig.isPath()) {
items.add(PathTypeFactory.create(indexPath, processedPropertyValue));
}
}
return items;
}
use of com.enonic.xp.index.IndexConfig in project xp by enonic.
the class DumpServiceImplTest method checkLanguageUpgrade.
private void checkLanguageUpgrade(final Node draftNode) {
final IndexConfig indexConfigBefore = draftNode.getIndexConfigDocument().getConfigForPath(PropertyPath.from("language"));
final List<String> languages = draftNode.getIndexConfigDocument().getAllTextConfig().getLanguages();
assertEquals(IndexConfig.NGRAM, indexConfigBefore);
assertEquals(1, languages.size());
assertEquals("no", languages.get(0));
}
use of com.enonic.xp.index.IndexConfig in project xp by enonic.
the class IndexConfigFactory method createPathConfigs.
private void createPathConfigs(final PatternIndexConfigDocument.Builder builder) {
final Iterable<PropertySet> pathConfigs = this.propertySet.getSets(CONFIG_ARRAY);
if (pathConfigs == null) {
return;
}
for (final PropertySet pathConfig : pathConfigs) {
final String path = pathConfig.getString(CONFIG_PATH);
final IndexConfig config = createConfig(pathConfig.getProperty(CONFIG_SETTINGS));
builder.add(path, config);
}
}
use of com.enonic.xp.index.IndexConfig in project xp by enonic.
the class IndexConfigFactory method create.
private IndexConfig create(final PropertySet settings) {
final Boolean decideByType = settings.getBoolean("decideByType");
final Boolean enabled = settings.getBoolean("enabled");
final Boolean nGram = settings.getBoolean("nGram");
final Boolean fulltext = settings.getBoolean("fulltext");
final Boolean includeInAllText = settings.getBoolean("includeInAllText");
final Boolean path = settings.getBoolean("path");
final Iterable<String> indexValueProcessors = settings.getStrings("indexValueProcessors");
final Iterable<String> languages = settings.getStrings("languages");
final IndexConfig.Builder builder = IndexConfig.create().decideByType(decideByType != null ? decideByType : false).enabled(enabled != null ? enabled : true).nGram(nGram != null ? nGram : false).fulltext(fulltext != null ? fulltext : false).includeInAllText(includeInAllText != null ? includeInAllText : false).path(path != null ? path : false);
for (final String indexValueProcessorName : indexValueProcessors) {
final IndexValueProcessor indexValueProcessor = IndexValueProcessors.get(indexValueProcessorName);
if (indexValueProcessor != null) {
builder.addIndexValueProcessor(indexValueProcessor);
}
}
for (final String language : languages) {
builder.addLanguage(language);
}
return builder.build();
}
use of com.enonic.xp.index.IndexConfig in project xp by enonic.
the class IndexConfigVisitor method visit.
@Override
public void visit(final Input input) {
if (InputTypeName.HTML_AREA.equals(input.getInputType())) {
final IndexConfig htmlIndexConfig = IndexConfig.create().enabled(true).fulltext(true).nGram(true).decideByType(false).includeInAllText(true).addIndexValueProcessor(IndexValueProcessors.HTML_STRIPPER).build();
configDocumentBuilder.add(createPath(input), htmlIndexConfig);
}
}
Aggregations