use of io.vertigo.dynamo.collections.ListFilter in project vertigo by KleeGroup.
the class DslListFilterBuilderTest method testStringFixedQuery.
private void testStringFixedQuery(final String[]... testData) {
int i = 0;
for (final String[] testParam : testData) {
final ListFilter listFilter = createListFilterBuilder(String.class).withBuildQuery(testParam[0]).withCriteria(testParam[1]).build();
final String result = listFilter.getFilterValue();
final String expectedResult = testParam[Math.min(getPreferedResult(), testParam.length - 1)];
Assert.assertEquals("Built query #" + i + " incorrect", expectedResult, result);
i++;
}
}
use of io.vertigo.dynamo.collections.ListFilter in project vertigo by KleeGroup.
the class DslListFilterBuilderTest method testObjectFixedQuery.
private void testObjectFixedQuery(final Object[]... testData) {
int i = 0;
for (final Object[] testParam : testData) {
final ListFilter listFilter = createListFilterBuilder(Object.class).withBuildQuery((String) testParam[0]).withCriteria(testParam[1]).build();
final String result = listFilter.getFilterValue();
final Object expectedResult = testParam[Math.min(getPreferedResult(), testParam.length - 1)];
Assert.assertEquals("Built query #" + i + " incorrect", expectedResult, result);
i++;
}
}
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 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 SearchManagerMultiIndexTest method testClean.
/**
* Test de création nettoyage de l'index.
* La création s'effectue dans une seule transaction.
*/
@Test
public void testClean() {
final DefinitionSpace definitionSpace = getApp().getDefinitionSpace();
final SearchIndexDefinition carIndexDefinition = definitionSpace.resolve(IDX_CAR, SearchIndexDefinition.class);
final SearchIndexDefinition carDynIndexDefinition = definitionSpace.resolve(IDX_DYNA_CAR, SearchIndexDefinition.class);
final ListFilter removeQuery = ListFilter.of("*:*");
searchManager.removeAll(carIndexDefinition, removeQuery);
searchManager.removeAll(carDynIndexDefinition, removeQuery);
waitIndexation();
final long sizeCar = query("*:*", carIndexDefinition);
Assert.assertEquals(0, sizeCar);
final long sizeCarDyn = query("*:*", carDynIndexDefinition);
Assert.assertEquals(0, sizeCarDyn);
}
Aggregations