Search in sources :

Example 1 with HighlightQuerySettings

use of com.enonic.xp.query.highlight.HighlightQuerySettings in project xp by enonic.

the class QueryHighlightParams method getHighlightQuery.

HighlightQuery getHighlightQuery(final Map<String, Object> highlightMap) {
    if (highlightMap == null) {
        return HighlightQuery.empty();
    }
    final HighlightQuerySettings settings = fillQuerySettings(HighlightQuerySettings.create(), highlightMap).build();
    final HighlightQuery.Builder highlightQuery = HighlightQuery.create().settings(settings);
    final Map<String, Object> propertiesMap = (Map<String, Object>) highlightMap.get("properties");
    if (propertiesMap == null) {
        return HighlightQuery.empty();
    }
    propertiesMap.forEach((name, propertyMap) -> {
        final HighlightQueryProperty highlightQueryProperty = highlightPropertyFromParams(name, (Map<String, Object>) propertyMap);
        highlightQuery.property(highlightQueryProperty);
    });
    return highlightQuery.build();
}
Also used : HighlightQueryProperty(com.enonic.xp.query.highlight.HighlightQueryProperty) HighlightQuerySettings(com.enonic.xp.query.highlight.HighlightQuerySettings) HighlightQuery(com.enonic.xp.query.highlight.HighlightQuery) Map(java.util.Map)

Example 2 with HighlightQuerySettings

use of com.enonic.xp.query.highlight.HighlightQuerySettings in project xp by enonic.

the class QueryHighlightParams method getHighlightQuery.

HighlightQuery getHighlightQuery(final Map<String, Object> highlightMap) {
    if (highlightMap == null) {
        return HighlightQuery.empty();
    }
    final HighlightQuerySettings settings = fillQuerySettings(HighlightQuerySettings.create(), highlightMap).build();
    final HighlightQuery.Builder highlightQuery = HighlightQuery.create().settings(settings);
    final Map<String, Object> propertiesMap = (Map<String, Object>) highlightMap.get("properties");
    if (propertiesMap == null) {
        return HighlightQuery.empty();
    }
    propertiesMap.forEach((name, propertyMap) -> {
        final HighlightQueryProperty highlightQueryProperty = highlightPropertyFromParams(name, (Map<String, Object>) propertyMap);
        highlightQuery.property(highlightQueryProperty);
    });
    return highlightQuery.build();
}
Also used : HighlightQueryProperty(com.enonic.xp.query.highlight.HighlightQueryProperty) HighlightQuerySettings(com.enonic.xp.query.highlight.HighlightQuerySettings) HighlightQuery(com.enonic.xp.query.highlight.HighlightQuery) Map(java.util.Map)

Aggregations

HighlightQuery (com.enonic.xp.query.highlight.HighlightQuery)2 HighlightQueryProperty (com.enonic.xp.query.highlight.HighlightQueryProperty)2 HighlightQuerySettings (com.enonic.xp.query.highlight.HighlightQuerySettings)2 Map (java.util.Map)2