Example usage for org.springframework.data.solr.core.query QueryParameter getName

List of usage examples for org.springframework.data.solr.core.query QueryParameter getName

Introduction

In this page you can find the example usage for org.springframework.data.solr.core.query QueryParameter getName.

Prototype

String getName();

Source Link

Usage

From source file:org.springframework.data.solr.core.DefaultQueryParser.java

private void addOptionToSolrQuery(SolrQuery solrQuery, QueryParameter option) {
    if (option != null && StringUtils.isNotBlank(option.getName())) {
        solrQuery.add(option.getName(), conversionService.convert(option.getValue(), String.class));
    }/*www .j a  v a2 s .  c  om*/
}

From source file:org.springframework.data.solr.core.DefaultQueryParser.java

private void addFieldSpecificParameterToSolrQuery(SolrQuery solrQuery, Field field, QueryParameter option) {
    if (option != null && field != null && StringUtils.isNotBlank(option.getName())) {
        if (option.getValue() == null) {
            solrQuery.add(createPerFieldOverrideParameterName(field, option.getName()), (String) null);
        } else {// w w  w .  j  a v a  2s  .  c  o  m
            String value = option.getValue().toString();
            if (conversionService.canConvert(option.getValue().getClass(), String.class)) {
                value = conversionService.convert(option.getValue(), String.class);
            }
            solrQuery.add(createPerFieldOverrideParameterName(field, option.getName()), value);
        }
    }
}