You are here

public function SolrFieldType::getUnstemmedFieldTypeAsJson in Search API Solr 4.x

Same name and namespace in other branches
  1. 8.3 src/Entity/SolrFieldType.php \Drupal\search_api_solr\Entity\SolrFieldType::getUnstemmedFieldTypeAsJson()

Gets the Solr Unstemmed Field Type definition as JSON.

The JSON format is used to interact with a managed Solr schema.

Parameters

bool $pretty: Return pretty printed JSON.

Return value

string The Solr Unstemmed Field Type definition as JSON.

Overrides SolrFieldTypeInterface::getUnstemmedFieldTypeAsJson

File

src/Entity/SolrFieldType.php, line 339

Class

SolrFieldType
Defines the SolrFieldType entity.

Namespace

Drupal\search_api_solr\Entity

Code

public function getUnstemmedFieldTypeAsJson(bool $pretty = FALSE) {
  if ($this->unstemmed_field_type) {

    /** @noinspection PhpComposerExtensionStubsInspection */
    return $pretty ? json_encode($this->unstemmed_field_type, JSON_PRETTY_PRINT | JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT) : Json::encode($this->unstemmed_field_type);
  }
  return '';
}