public function buildBoostedFields($fields)
    {
        // Assume strings are pre-formatted.
        if (is_string($fields)) {
            return $fields;
        }

        $processed = array();
        foreach ($fields as $fieldName => $boost) {
            if (!is_array($boost)) {
                $processed[] = $fieldName . '^' . $boost;
            } else {
                $field = $fieldName . '~' . $boost[0];
                if (isset($boost[1])) {
                    $field .= '^' . $boost[1];
                }
                $processed[] = $field;
            }
        }
        return join(',', $processed);
    }
public function buildBoostedFields($fields)
    {
        // Assume strings are pre-formatted.
        if (is_string($fields)) {
            return $fields;
        }

        $processed = array();
        foreach ($fields as $fieldName => $boost) {
            if (!is_array($boost)) {
                $processed[] = $fieldName . '^' . $boost;
            } else {
                $field = $fieldName . '~' . $boost[0];
                if (isset($boost[1])) {
                    $field .= '^' . $boost[1];
                }
                $processed[] = $field;
            }
        }
        return join(',', $processed);
    }
public function buildBoostedFields ( $ fields ) { // Assume strings are pre-formatted. if ( is_string ( $ fields ) ) { return $ fields ; } $ processed = array ( ) ; foreach ( $ fields as $ fieldName => $ boost ) { if ( ! is_array ( $ boost ) ) { $ processed [ ] = $ fieldName . '^' . $ boost ; } else { $ field = $ fieldName . '~' . $ boost [ 0 ] ; if ( isset ( $ boost [ 1 ] ) ) { $ field .= '^' . $ boost [ 1 ] ; } $ processed [ ] = $ field ; } } return join ( ',' , $ processed ) ; }
Helper function that turns associative arrays into boosted fields.

- array('field' => 10.0) = "field^10.0".
- array('field' => array(2, 10.0) = "field~2^10.0"

@param string|array $fields

@see https://wiki.apache.org/solr/DisMaxQParserPlugin#qf_.28Query_Fields.29

@todo Rethink this.
Helper function that turns associative arrays into boosted fields .