You are here

private function Solr::generateLine in Search API Synonym 8

Generate a single synonyms line for the export file.

Parameters

string $word: The main word.

string $synonyms: The comma separated string with synonyms.

string $type: Synonym (synonym) og Spelling error (spelling_error)

Return value

string Return the single line with synonyms and the corresponding word.

1 call to Solr::generateLine()
Solr::getFormattedSynonyms in src/Plugin/search_api_synonym/export/Solr.php
Get synonyms in the export format. *

File

src/Plugin/search_api_synonym/export/Solr.php, line 54

Class

Solr
Provides a synonym export plugin for Apache Solr..

Namespace

Drupal\search_api_synonym\Plugin\search_api_synonym\export

Code

private function generateLine($word, $synonyms, $type) {
  $line = '';
  switch ($type) {
    case 'synonym':

      // We force using of equivalent mappings for type = synonym.
      $line = "{$word}, {$synonyms}";
      break;
    case 'spelling_error':
      $line = "{$word} => {$synonyms}";
      break;
  }
  return $line;
}