use of io.vertigo.dynamo.collections.ListFilter in project vertigo by KleeGroup.
the class RamLuceneQueryFactory method createFilteredQuery.
private static Query createFilteredQuery(final Analyzer queryAnalyser, final Query keywordsQuery, final List<ListFilter> filters) {
final Builder queryBuilder = new BooleanQuery.Builder().add(keywordsQuery, BooleanClause.Occur.MUST);
final StandardQueryParser queryParser = new StandardQueryParser(queryAnalyser);
for (final ListFilter filter : filters) {
try {
queryBuilder.add(queryParser.parse(filter.getFilterValue(), null), isExclusion(filter) ? BooleanClause.Occur.MUST_NOT : BooleanClause.Occur.MUST);
} catch (final QueryNodeException e) {
throw WrappedException.wrap(e, "Erreur lors de la création du filtrage de la requete");
}
}
return queryBuilder.build();
}
use of io.vertigo.dynamo.collections.ListFilter in project vertigo by KleeGroup.
the class FacetFactory method createTermCluster.
private static <D extends DtObject> Map<FacetValue, DtList<D>> createTermCluster(final FacetDefinition facetDefinition, final DtList<D> dtList) {
// map résultat avec les docs par FacetFilter
final Map<FacetValue, DtList<D>> clusterValues = new LinkedHashMap<>();
// Cas des facettes par Term
final DtField dtField = facetDefinition.getDtField();
// on garde un index pour incrémenter le facetFilter pour chaque Term
final Map<Object, FacetValue> facetFilterIndex = new HashMap<>();
FacetValue facetValue;
for (final D dto : dtList) {
final Object value = dtField.getDataAccessor().getValue(dto);
facetValue = facetFilterIndex.get(value);
if (facetValue == null) {
final String valueAsString = dtField.getDomain().valueToString(value);
final String label;
if (StringUtil.isEmpty(valueAsString)) {
label = "<==no label==>";
} else {
label = valueAsString;
}
final MessageText labelMsg = MessageText.of(label);
// on garde la syntaxe Solr pour l'instant
final ListFilter listFilter = ListFilter.of(dtField.getName() + ":\"" + valueAsString + "\"");
facetValue = new FacetValue(label, listFilter, labelMsg);
facetFilterIndex.put(value, facetValue);
clusterValues.put(facetValue, new DtList<D>(dtList.getDefinition()));
}
clusterValues.get(facetValue).add(dto);
}
// tri des facettes
final Comparator<FacetValue> facetComparator = new FacetComparator<>(clusterValues);
final Map<FacetValue, DtList<D>> sortedFacetValues = new TreeMap<>(facetComparator);
sortedFacetValues.putAll(clusterValues);
return sortedFacetValues;
}
use of io.vertigo.dynamo.collections.ListFilter in project vertigo by KleeGroup.
the class AbstractSearchManagerTest method clean.
/**
* @param indexDefinition Definition de l'index
*/
private void clean(final SearchIndexDefinition indexDefinition) {
final ListFilter removeQuery = ListFilter.of("*:*");
searchManager.removeAll(indexDefinition, removeQuery);
}
use of io.vertigo.dynamo.collections.ListFilter in project vertigo by KleeGroup.
the class SearchManagerStoreTest method doRemove.
private void doRemove(final String query) {
final ListFilter removeQuery = ListFilter.of(query);
searchManager.removeAll(itemIndexDefinition, removeQuery);
}
use of io.vertigo.dynamo.collections.ListFilter in project vertigo by KleeGroup.
the class AbstractSearchManagerTest method doRemove.
private void doRemove(final String query) {
final ListFilter removeQuery = ListFilter.of(query);
searchManager.removeAll(carIndexDefinition, removeQuery);
}
Aggregations