Search in sources :

Example 1 with SUGGESTION_RESULT_KEY

use of ddf.catalog.Constants.SUGGESTION_RESULT_KEY in project ddf by codice.

the class SolrMetacardClientImpl method handleSuggestionResponse.

private void handleSuggestionResponse(QueryResponse solrResponse, Map<String, Serializable> responseProps) {
    SuggesterResponse suggesterResponse = solrResponse.getSuggesterResponse();
    if (suggesterResponse != null) {
        List<Map.Entry<String, String>> suggestionResults = suggesterResponse.getSuggestions().values().stream().flatMap(List::stream).map(suggestion -> new AbstractMap.SimpleImmutableEntry<>(suggestion.getPayload(), suggestion.getTerm())).collect(Collectors.toList());
        responseProps.put(SUGGESTION_RESULT_KEY, (Serializable) suggestionResults);
    }
}
Also used : ADDITIONAL_SORT_BYS(ddf.catalog.Constants.ADDITIONAL_SORT_BYS) Arrays(java.util.Arrays) SimpleOrderedMap(org.apache.solr.common.util.SimpleOrderedMap) SolrDocumentList(org.apache.solr.common.SolrDocumentList) SolrClient(org.codice.solr.client.solrj.SolrClient) UnsupportedQueryException(ddf.catalog.source.UnsupportedQueryException) LoggerFactory(org.slf4j.LoggerFactory) MetacardCreationException(ddf.catalog.data.MetacardCreationException) TermFacetProperties(ddf.catalog.operation.TermFacetProperties) AttributeType(ddf.catalog.data.AttributeType) NumberUtils(org.apache.commons.lang.math.NumberUtils) BooleanUtils(org.apache.commons.lang.BooleanUtils) SolrServerException(org.apache.solr.client.solrj.SolrServerException) SolrException(org.apache.solr.common.SolrException) FIRST_CHAR_OF_SUFFIX(ddf.catalog.source.solr.DynamicSchemaResolver.FIRST_CHAR_OF_SUFFIX) ContentTypeImpl(ddf.catalog.data.impl.ContentTypeImpl) Map(java.util.Map) SUGGESTION_QUERY_KEY(ddf.catalog.Constants.SUGGESTION_QUERY_KEY) SourceResponseImpl(ddf.catalog.operation.impl.SourceResponseImpl) Collection(java.util.Collection) AbstractUpdateRequest(org.apache.solr.client.solrj.request.AbstractUpdateRequest) ResultImpl(ddf.catalog.data.impl.ResultImpl) Set(java.util.Set) PrivilegedAction(java.security.PrivilegedAction) Collation(org.apache.solr.client.solrj.response.SpellCheckResponse.Collation) Collectors(java.util.stream.Collectors) Sets(com.google.common.collect.Sets) MetacardType(ddf.catalog.data.MetacardType) Serializable(java.io.Serializable) List(java.util.List) Attribute(ddf.catalog.data.Attribute) SUGGEST_DICT(org.apache.solr.spelling.suggest.SuggesterParams.SUGGEST_DICT) SolrQuery(org.apache.solr.client.solrj.SolrQuery) Optional(java.util.Optional) SUGGEST_BUILD(org.apache.solr.spelling.suggest.SuggesterParams.SUGGEST_BUILD) AccessController(java.security.AccessController) SolrInputDocument(org.apache.solr.common.SolrInputDocument) QueryResponseImpl(ddf.catalog.operation.impl.QueryResponseImpl) AttributeImpl(ddf.catalog.data.impl.AttributeImpl) HashMap(java.util.HashMap) FilterAdapter(ddf.catalog.filter.FilterAdapter) Supplier(java.util.function.Supplier) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) FacetAttributeResultImpl(ddf.catalog.operation.impl.FacetAttributeResultImpl) SortBy(org.opengis.filter.sort.SortBy) Lists(com.google.common.collect.Lists) METHOD(org.apache.solr.client.solrj.SolrRequest.METHOD) FacetAttributeResult(ddf.catalog.operation.FacetAttributeResult) Metacard(ddf.catalog.data.Metacard) CollectionUtils(org.apache.commons.collections.CollectionUtils) FacetField(org.apache.solr.client.solrj.response.FacetField) MetacardImpl(ddf.catalog.data.impl.MetacardImpl) QueryRequest(ddf.catalog.operation.QueryRequest) SUGGEST_CONTEXT_FILTER_QUERY(org.apache.solr.spelling.suggest.SuggesterParams.SUGGEST_CONTEXT_FILTER_QUERY) Result(ddf.catalog.data.Result) SortOrder(org.opengis.filter.sort.SortOrder) SuggesterResponse(org.apache.solr.client.solrj.response.SuggesterResponse) ContentType(ddf.catalog.data.ContentType) Logger(org.slf4j.Logger) QueryResponse(org.apache.solr.client.solrj.response.QueryResponse) EXPERIMENTAL_FACET_PROPERTIES_KEY(ddf.catalog.Constants.EXPERIMENTAL_FACET_PROPERTIES_KEY) SUGGESTION_RESULT_KEY(ddf.catalog.Constants.SUGGESTION_RESULT_KEY) IOException(java.io.IOException) EXPERIMENTAL_FACET_RESULTS_KEY(ddf.catalog.Constants.EXPERIMENTAL_FACET_RESULTS_KEY) CommonParams(org.apache.solr.common.params.CommonParams) SUGGESTION_BUILD_KEY(ddf.catalog.Constants.SUGGESTION_BUILD_KEY) SolrDocument(org.apache.solr.common.SolrDocument) SourceResponse(ddf.catalog.operation.SourceResponse) AbstractMap(java.util.AbstractMap) SUGGESTION_DICT_KEY(ddf.catalog.Constants.SUGGESTION_DICT_KEY) PivotField(org.apache.solr.client.solrj.response.PivotField) Distance(ddf.measure.Distance) SUGGESTION_CONTEXT_KEY(ddf.catalog.Constants.SUGGESTION_CONTEXT_KEY) Collections(java.util.Collections) SUGGEST_Q(org.apache.solr.spelling.suggest.SuggesterParams.SUGGEST_Q) SuggesterResponse(org.apache.solr.client.solrj.response.SuggesterResponse) SolrDocumentList(org.apache.solr.common.SolrDocumentList) List(java.util.List) ArrayList(java.util.ArrayList)

Aggregations

Lists (com.google.common.collect.Lists)1 Sets (com.google.common.collect.Sets)1 ADDITIONAL_SORT_BYS (ddf.catalog.Constants.ADDITIONAL_SORT_BYS)1 EXPERIMENTAL_FACET_PROPERTIES_KEY (ddf.catalog.Constants.EXPERIMENTAL_FACET_PROPERTIES_KEY)1 EXPERIMENTAL_FACET_RESULTS_KEY (ddf.catalog.Constants.EXPERIMENTAL_FACET_RESULTS_KEY)1 SUGGESTION_BUILD_KEY (ddf.catalog.Constants.SUGGESTION_BUILD_KEY)1 SUGGESTION_CONTEXT_KEY (ddf.catalog.Constants.SUGGESTION_CONTEXT_KEY)1 SUGGESTION_DICT_KEY (ddf.catalog.Constants.SUGGESTION_DICT_KEY)1 SUGGESTION_QUERY_KEY (ddf.catalog.Constants.SUGGESTION_QUERY_KEY)1 SUGGESTION_RESULT_KEY (ddf.catalog.Constants.SUGGESTION_RESULT_KEY)1 Attribute (ddf.catalog.data.Attribute)1 AttributeType (ddf.catalog.data.AttributeType)1 ContentType (ddf.catalog.data.ContentType)1 Metacard (ddf.catalog.data.Metacard)1 MetacardCreationException (ddf.catalog.data.MetacardCreationException)1 MetacardType (ddf.catalog.data.MetacardType)1 Result (ddf.catalog.data.Result)1 AttributeImpl (ddf.catalog.data.impl.AttributeImpl)1 ContentTypeImpl (ddf.catalog.data.impl.ContentTypeImpl)1 MetacardImpl (ddf.catalog.data.impl.MetacardImpl)1