Search in sources :

Example 6 with FieldDescriptor

use of com.rbmhtechnology.vind.model.FieldDescriptor in project vind by RBMHTechnology.

the class SolrFilterSerializer method getFieldName.

private String getFieldName(String name, String searchContext, SolrUtils.Fieldname.UseCase usecase) {
    FieldDescriptor descriptor = factory.getField(name);
    if (Objects.isNull(descriptor)) {
        log.error("Unable to serialize solr filter: there is no field descriptor with name '{}'", name);
        throw new IllegalArgumentException("Unable to serialize solr filter: there is no field descriptor with name '" + name + "'");
    }
    if (Objects.isNull(usecase)) {
        usecase = SolrUtils.Fieldname.UseCase.Facet;
    }
    final String fieldName = SolrUtils.Fieldname.getFieldname(descriptor, usecase, searchContext);
    if (Objects.isNull(fieldName)) {
        log.error("Unable to serialize solr filter: there is no valid solr field for descriptor with name '{}' and use case {}", name, usecase);
        throw new RuntimeException("Unable to serialize solr filter: there is no valid solr field for descriptor with name '" + name + "' and use case " + usecase);
    }
    return fieldName;
}
Also used : FieldDescriptor(com.rbmhtechnology.vind.model.FieldDescriptor)

Example 7 with FieldDescriptor

use of com.rbmhtechnology.vind.model.FieldDescriptor in project vind by RBMHTechnology.

the class SolrChildrenSerializerVisitor method isHierarchical.

private boolean isHierarchical(String fieldName) {
    if (Objects.nonNull(this.childFactory)) {
        FieldDescriptor parentDescriptor = this.parentFactory.getField(fieldName);
        FieldDescriptor childDescriptor = this.childFactory.getField(fieldName);
        if (Objects.nonNull(parentDescriptor) && Objects.isNull(childDescriptor)) {
            return true;
        }
        return false;
    }
    return true;
}
Also used : FieldDescriptor(com.rbmhtechnology.vind.model.FieldDescriptor)

Example 8 with FieldDescriptor

use of com.rbmhtechnology.vind.model.FieldDescriptor in project vind by RBMHTechnology.

the class SolrChildrenSerializerVisitor method getFieldName.

private String getFieldName(String name, String searchContext, SolrUtils.Fieldname.UseCase usecase, DocumentFactory factory) {
    FieldDescriptor descriptor = factory.getField(name);
    if (Objects.isNull(descriptor)) {
        log.error("Unable to serialize solr filter: there is no field descriptor with name '{}'", name);
        throw new RuntimeException("Unable to serialize solr filter: there is no field descriptor with name '" + name + "'");
    }
    if (Objects.isNull(usecase)) {
        usecase = SolrUtils.Fieldname.UseCase.Facet;
    }
    final String fieldName = SolrUtils.Fieldname.getFieldname(descriptor, usecase, searchContext);
    if (Objects.isNull(fieldName)) {
        log.error("Unable to serialize solr filter: there is no valid solr field for descriptor with name '{}' and use case {}", name, usecase);
        throw new RuntimeException("Unable to serialize solr filter: there is no valid solr field for descriptor with name '" + name + "' and use case " + usecase);
    }
    return fieldName;
}
Also used : FieldDescriptor(com.rbmhtechnology.vind.model.FieldDescriptor)

Example 9 with FieldDescriptor

use of com.rbmhtechnology.vind.model.FieldDescriptor in project vind by RBMHTechnology.

the class SolrFilterSerializerVisitor method getFieldName.

private String getFieldName(String name, String searchContext, SolrUtils.Fieldname.UseCase usecase, DocumentFactory factory) {
    FieldDescriptor descriptor = factory.getField(name);
    if (Objects.isNull(descriptor)) {
        log.error("Unable to serialize solr filter: there is no field descriptor with name '{}'", name);
        throw new IllegalArgumentException("Unable to serialize solr filter: there is no field descriptor with name '" + name + "'");
    }
    if (Objects.isNull(usecase)) {
        usecase = SolrUtils.Fieldname.UseCase.Facet;
    }
    final String fieldName = SolrUtils.Fieldname.getFieldname(descriptor, usecase, searchContext);
    if (Objects.isNull(fieldName)) {
        log.error("Unable to serialize solr filter: there is no valid solr field for descriptor with name '{}' and use case {}", name, usecase);
        throw new RuntimeException("Unable to serialize solr filter: there is no valid solr field for descriptor with name '" + name + "' and use case " + usecase);
    }
    return fieldName;
}
Also used : FieldDescriptor(com.rbmhtechnology.vind.model.FieldDescriptor)

Example 10 with FieldDescriptor

use of com.rbmhtechnology.vind.model.FieldDescriptor in project vind by RBMHTechnology.

the class SolrFilterSerializerVisitor method isHierarchical.

private boolean isHierarchical(String fieldName) {
    if (Objects.nonNull(this.childFactory)) {
        FieldDescriptor parentDescriptor = this.parentFactory.getField(fieldName);
        FieldDescriptor childDescriptor = this.childFactory.getField(fieldName);
        if (Objects.nonNull(childDescriptor) && Objects.isNull(parentDescriptor)) {
            return true;
        }
        return false;
    }
    return false;
}
Also used : FieldDescriptor(com.rbmhtechnology.vind.model.FieldDescriptor)

Aggregations

FieldDescriptor (com.rbmhtechnology.vind.model.FieldDescriptor)11 ExecutableSuggestionSearch (com.rbmhtechnology.vind.api.query.suggestion.ExecutableSuggestionSearch)4 DocumentFactory (com.rbmhtechnology.vind.model.DocumentFactory)4 IOException (java.io.IOException)4 SolrClient (org.apache.solr.client.solrj.SolrClient)4 SolrQuery (org.apache.solr.client.solrj.SolrQuery)4 Resources (com.google.common.io.Resources)3 SearchServerException (com.rbmhtechnology.vind.SearchServerException)3 AnnotationUtil (com.rbmhtechnology.vind.annotations.AnnotationUtil)3 Document (com.rbmhtechnology.vind.api.Document)3 SearchServer (com.rbmhtechnology.vind.api.SearchServer)3 ServiceProvider (com.rbmhtechnology.vind.api.ServiceProvider)3 com.rbmhtechnology.vind.api.query (com.rbmhtechnology.vind.api.query)3 Delete (com.rbmhtechnology.vind.api.query.delete.Delete)3 Page (com.rbmhtechnology.vind.api.query.division.Page)3 Slice (com.rbmhtechnology.vind.api.query.division.Slice)3 Facet (com.rbmhtechnology.vind.api.query.facet.Facet)3 Interval (com.rbmhtechnology.vind.api.query.facet.Interval)3 RealTimeGet (com.rbmhtechnology.vind.api.query.get.RealTimeGet)3 DescriptorSuggestionSearch (com.rbmhtechnology.vind.api.query.suggestion.DescriptorSuggestionSearch)3