Search in sources :

Example 11 with DtListState

use of io.vertigo.dynamo.domain.model.DtListState in project vertigo by KleeGroup.

the class AbstractESSearchServicesPlugin method loadList.

/**
 * {@inheritDoc}
 */
@Override
public final <R extends DtObject> FacetedQueryResult<R, SearchQuery> loadList(final SearchIndexDefinition indexDefinition, final SearchQuery searchQuery, final DtListState listState) {
    Assertion.checkNotNull(searchQuery);
    // -----
    final ESStatement<KeyConcept, R> statement = createElasticStatement(indexDefinition);
    final DtListState usedListState = listState != null ? listState : defaultListState;
    return statement.loadList(indexDefinition, searchQuery, usedListState, defaultMaxRows);
}
Also used : KeyConcept(io.vertigo.dynamo.domain.model.KeyConcept) DtListState(io.vertigo.dynamo.domain.model.DtListState)

Example 12 with DtListState

use of io.vertigo.dynamo.domain.model.DtListState in project vertigo by KleeGroup.

the class AbstractSearchManagerTest method doQueryAndGetFirst.

private Car doQueryAndGetFirst(final String query, final String sortField, final boolean sortDesc) {
    // recherche
    final SearchQuery searchQuery = SearchQuery.builder(ListFilter.of(query)).build();
    final DtListState listState = new DtListState(null, 0, carIndexDefinition.getIndexDtDefinition().getField(sortField).getName(), sortDesc);
    final DtList<Car> dtList = doQuery(searchQuery, listState).getDtList();
    Assert.assertFalse("Result list was empty", dtList.isEmpty());
    return dtList.get(0);
}
Also used : SearchQuery(io.vertigo.dynamo.search.model.SearchQuery) Car(io.vertigo.dynamo.search_2_4.data.domain.Car) DtListState(io.vertigo.dynamo.domain.model.DtListState)

Example 13 with DtListState

use of io.vertigo.dynamo.domain.model.DtListState in project vertigo by KleeGroup.

the class IndexFilterFunction method apply.

/**
 * {@inheritDoc}
 */
@Override
public DtList<D> apply(final DtList<D> dtc) {
    Assertion.checkNotNull(dtc);
    // -----
    final DtListState dtListState = new DtListState(top, skip, sortFieldName, sortDesc);
    return indexPlugin.getCollection(keywords, searchedFields, listFilters, dtListState, Optional.empty(), dtc);
}
Also used : DtListState(io.vertigo.dynamo.domain.model.DtListState)

Example 14 with DtListState

use of io.vertigo.dynamo.domain.model.DtListState in project vertigo by KleeGroup.

the class DtListStateDeserializer method deserialize.

@Override
public DtListState deserialize(final JsonElement json, final Type typeOfT, final JsonDeserializationContext context) throws JsonParseException {
    final JsonObject jsonObject = json.getAsJsonObject();
    final Integer top = jsonObject.has("top") ? jsonObject.get("top").getAsInt() : null;
    final int skip = jsonObject.has("skip") ? jsonObject.get("skip").getAsInt() : 0;
    final String sortFieldName = jsonObject.has("sortFieldName") ? jsonObject.get("sortFieldName").getAsString() : null;
    final Boolean sortDesc = jsonObject.has("sortDesc") ? jsonObject.get("sortDesc").getAsBoolean() : null;
    return new DtListState(top, skip, sortFieldName, sortDesc);
}
Also used : JsonObject(com.google.gson.JsonObject) DtListState(io.vertigo.dynamo.domain.model.DtListState)

Aggregations

DtListState (io.vertigo.dynamo.domain.model.DtListState)14 SearchQuery (io.vertigo.dynamo.search.model.SearchQuery)8 Test (org.junit.Test)7 DtList (io.vertigo.dynamo.domain.model.DtList)5 Item (io.vertigo.dynamo.search.data.domain.Item)5 FacetValue (io.vertigo.dynamo.collections.model.FacetValue)4 Car (io.vertigo.dynamo.search_2_4.data.domain.Car)4 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)4 List (java.util.List)4 AbstractTestCaseJU4 (io.vertigo.AbstractTestCaseJU4)2 DefinitionSpace (io.vertigo.core.definition.DefinitionSpace)2 ListFilter (io.vertigo.dynamo.collections.ListFilter)2 FacetDefinition (io.vertigo.dynamo.collections.metamodel.FacetDefinition)2 FacetedQueryDefinition (io.vertigo.dynamo.collections.metamodel.FacetedQueryDefinition)2 Facet (io.vertigo.dynamo.collections.model.Facet)2 FacetedQuery (io.vertigo.dynamo.collections.model.FacetedQuery)2 FacetedQueryResult (io.vertigo.dynamo.collections.model.FacetedQueryResult)2 SelectedFacetValues (io.vertigo.dynamo.collections.model.SelectedFacetValues)2 URI (io.vertigo.dynamo.domain.model.URI)2