You are here

static function Solr_Base_Query::make_field in Apache Solr Search 5

Takes an array $values and combines the #name and #value in a way suitable for use in a Solr query.

4 calls to Solr_Base_Query::make_field()
Solr_Base_Query::get_breadcrumb in ./Solr_Base_Query.php
Solr_Base_Query::parse_query in ./Solr_Base_Query.php
Solr_Base_Query::query_replace in ./Solr_Base_Query.php
Replaces all occurances of $option in $keys.
Solr_Base_Query::rebuild_query in ./Solr_Base_Query.php

File

./Solr_Base_Query.php, line 64

Class

Solr_Base_Query

Code

static function make_field(array $values) {
  if (empty($values['#name'])) {
    return implode(' ', array_filter(explode(' ', $values['#value']), 'trim'));
  }
  else {

    // if the field value has spaces in it, wrap it in double quotes.
    if (count(explode(' ', $values['#value'])) > 1) {
      $values['#value'] = '"' . $values['#value'] . '"';
    }
    return $values['#name'] . ':' . $values['#value'];
  }
}