Search in sources :

Example 1 with FieldList

use of com.odysseusinc.arachne.portal.service.impl.solr.FieldList in project ArachneCentralAPI by OHDSI.

the class SearchDTOToSolrQuery method convertToFullFacetsQuery.

/**
 * @return query for getting "full" facets for all data (without filter and query)
 */
public SolrQuery convertToFullFacetsQuery(SearchDTO source) {
    SolrQuery result = new SolrQuery();
    FieldList solrFields = getSolrFields();
    result.setRows(0);
    result.setStart(0);
    setQuery(source, result);
    setFacets(source, result, solrFields);
    return result;
}
Also used : SolrQuery(org.apache.solr.client.solrj.SolrQuery) FieldList(com.odysseusinc.arachne.portal.service.impl.solr.FieldList)

Example 2 with FieldList

use of com.odysseusinc.arachne.portal.service.impl.solr.FieldList in project ArachneCentralAPI by OHDSI.

the class SearchDTOToSolrQuery method convert.

public SolrQuery convert(SearchDTO source) {
    final SolrQuery result = new SolrQuery();
    final FieldList solrFields = getSolrFields();
    setSorting(source, result, solrFields);
    setPagination(source, result);
    setOutputFields(result, source.getResultFields());
    setQuery(source, result);
    setFilters(source, result, solrFields);
    setFacets(source, result, solrFields);
    setCollections(source, result);
    return result;
}
Also used : SolrQuery(org.apache.solr.client.solrj.SolrQuery) FieldList(com.odysseusinc.arachne.portal.service.impl.solr.FieldList)

Example 3 with FieldList

use of com.odysseusinc.arachne.portal.service.impl.solr.FieldList in project ArachneCentralAPI by OHDSI.

the class SearchResultToFacetedSearchResultDTOConverter method buildFacets.

protected Map<String, FacetOptionList> buildFacets(SearchResult source, FieldList solrFields) {
    Map<String, List<String>> excludedOptions = source.getExcludedOptions();
    NamedList response = source.getSolrResponse().getResponse();
    Map facetsMap = (Map) response.asMap(10).get("facets");
    Map<String, FacetOptionList> facets = new HashMap<>();
    // Facets for option list and numeric type
    List<FacetField> facetFieldList = source.getSolrResponse().getFacetFields();
    if (facetFieldList != null) {
        for (FacetField facetField : facetFieldList) {
            FacetOptionList facetOptionList = getFacetOptionList(facetsMap, facetField.getName(), excludedOptions.get(facetField.getName()));
            facets.put(solrFields.getBySolrName(facetField.getName()).getName(), facetOptionList);
        }
    }
    return facets;
}
Also used : FacetOptionList(com.odysseusinc.arachne.portal.api.v1.dto.FacetOptionList) HashMap(java.util.HashMap) NamedList(org.apache.solr.common.util.NamedList) FacetField(org.apache.solr.client.solrj.response.FacetField) FieldList(com.odysseusinc.arachne.portal.service.impl.solr.FieldList) NamedList(org.apache.solr.common.util.NamedList) ArrayList(java.util.ArrayList) List(java.util.List) FacetOptionList(com.odysseusinc.arachne.portal.api.v1.dto.FacetOptionList) SimpleOrderedMap(org.apache.solr.common.util.SimpleOrderedMap) HashMap(java.util.HashMap) Map(java.util.Map)

Example 4 with FieldList

use of com.odysseusinc.arachne.portal.service.impl.solr.FieldList in project ArachneCentralAPI by OHDSI.

the class BaseSolrServiceImpl method getFieldsOfClass.

public FieldList<T> getFieldsOfClass(final Class<?> entity) {
    final FieldList<T> result = new FieldList<>();
    final List<Field> fields = getDeclaredFields(entity);
    for (final Field field : fields) {
        final T solrField = getSolrField(field);
        if (solrField != null) {
            result.add(solrField);
        }
    }
    result.addAll(gatherClassSolrAnnotations(entity));
    return result;
}
Also used : SolrField(com.odysseusinc.arachne.portal.service.impl.solr.SolrField) Field(java.lang.reflect.Field) FieldList(com.odysseusinc.arachne.portal.service.impl.solr.FieldList)

Example 5 with FieldList

use of com.odysseusinc.arachne.portal.service.impl.solr.FieldList in project ArachneCentralAPI by OHDSI.

the class BaseUserServiceImpl method getSolrFields.

@Override
public FieldList getSolrFields() {
    FieldList fieldList = new FieldList();
    fieldList.addAll(solrService.getFieldsOfClass(User.class));
    fieldList.addAll(getExtraSolrFields());
    return fieldList;
}
Also used : User(com.odysseusinc.arachne.portal.model.User) IUser(com.odysseusinc.arachne.portal.model.IUser) FieldList(com.odysseusinc.arachne.portal.service.impl.solr.FieldList)

Aggregations

FieldList (com.odysseusinc.arachne.portal.service.impl.solr.FieldList)5 SolrQuery (org.apache.solr.client.solrj.SolrQuery)2 FacetOptionList (com.odysseusinc.arachne.portal.api.v1.dto.FacetOptionList)1 IUser (com.odysseusinc.arachne.portal.model.IUser)1 User (com.odysseusinc.arachne.portal.model.User)1 SolrField (com.odysseusinc.arachne.portal.service.impl.solr.SolrField)1 Field (java.lang.reflect.Field)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 FacetField (org.apache.solr.client.solrj.response.FacetField)1 NamedList (org.apache.solr.common.util.NamedList)1 SimpleOrderedMap (org.apache.solr.common.util.SimpleOrderedMap)1