예제 #1
0
  private static Query createFilteredQuery(
      final Analyzer queryAnalyser, final Query keywordsQuery, final List<ListFilter> filters) {
    final BooleanQuery query = new BooleanQuery();
    query.add(keywordsQuery, BooleanClause.Occur.MUST);

    for (final ListFilter filter : filters) {
      final StandardQueryParser queryParser = new StandardQueryParser(queryAnalyser);
      try {
        query.add(
            queryParser.parse(filter.getFilterValue(), null),
            isExclusion(filter) ? BooleanClause.Occur.MUST_NOT : BooleanClause.Occur.MUST);
      } catch (final QueryNodeException e) {
        throw new WrappedException("Erreur lors de la création du filtrage de la requete", e);
      }
    }
    return query;
  }
예제 #2
0
 /** {@inheritDoc} */
 @Override
 public DtListProcessor<D> filter(final ListFilter listFilter) {
   final Predicate<D> filter = new DtListPatternFilter<>(listFilter.getFilterValue());
   return add(new FilterFunction<>(filter));
 }
예제 #3
0
 private static boolean isExclusion(final ListFilter listFilter) {
   final String listFilterValue = listFilter.getFilterValue().trim();
   return listFilterValue.startsWith("-");
 }