Search in sources :

Example 1 with Strings

use of sirius.kernel.commons.Strings in project sirius-biz by scireum.

the class SearchableEntity method updateSearchField.

@BeforeSave
protected void updateSearchField() {
    if (!isNew() && !isAnyMappingChanged()) {
        return;
    }
    BasicIndexTokenizer tokenizer = new BasicIndexTokenizer();
    StringBuilder contentBuilder = new StringBuilder();
    this.getDescriptor().getProperties().stream().filter(p -> p.getAnnotation(SearchContent.class).isPresent()).map(p -> p.getValue(this)).filter(Strings::isFilled).forEach(obj -> addContent(tokenizer, contentBuilder, obj));
    searchField = contentBuilder.toString();
}
Also used : StringMap(sirius.db.mixing.types.StringMap) NoJournal(sirius.biz.protocol.NoJournal) Strings(sirius.kernel.commons.Strings) ESOption(sirius.db.es.annotations.ESOption) StringListMap(sirius.db.mixing.types.StringListMap) Mapping(sirius.db.mixing.Mapping) BeforeSave(sirius.db.mixing.annotations.BeforeSave) NullAllowed(sirius.db.mixing.annotations.NullAllowed) BasicIndexTokenizer(sirius.db.text.BasicIndexTokenizer) NestedList(sirius.db.mixing.types.NestedList) StringList(sirius.db.mixing.types.StringList) IndexMode(sirius.db.es.annotations.IndexMode) Tokenizer(sirius.db.text.Tokenizer) ElasticEntity(sirius.db.es.ElasticEntity) Analyzed(sirius.db.es.annotations.Analyzed) BasicIndexTokenizer(sirius.db.text.BasicIndexTokenizer) BeforeSave(sirius.db.mixing.annotations.BeforeSave)

Aggregations

NoJournal (sirius.biz.protocol.NoJournal)1 ElasticEntity (sirius.db.es.ElasticEntity)1 Analyzed (sirius.db.es.annotations.Analyzed)1 ESOption (sirius.db.es.annotations.ESOption)1 IndexMode (sirius.db.es.annotations.IndexMode)1 Mapping (sirius.db.mixing.Mapping)1 BeforeSave (sirius.db.mixing.annotations.BeforeSave)1 NullAllowed (sirius.db.mixing.annotations.NullAllowed)1 NestedList (sirius.db.mixing.types.NestedList)1 StringList (sirius.db.mixing.types.StringList)1 StringListMap (sirius.db.mixing.types.StringListMap)1 StringMap (sirius.db.mixing.types.StringMap)1 BasicIndexTokenizer (sirius.db.text.BasicIndexTokenizer)1 Tokenizer (sirius.db.text.Tokenizer)1 Strings (sirius.kernel.commons.Strings)1