CirrusSearch
Elasticsearch-powered search for MediaWiki
|
Simple class for SuggestionsBuilder that needs to munge the title into a list of "subphrases" suggestions. More...
Public Member Functions | |
__construct ( $charRange, $maxSubPhrases=self::MAX_SUBPHRASES) | |
getRequiredFields () | |
@inheritDoc | |
build (array $inputDoc, $suggestType, $score, \Elastica\Document $suggestDoc, $targetNamespace) | |
splitTranslatedPage ( $title, $language) | |
Split a translated page title into an array with the title at offset 0 and the language subpage at offset 1. | |
tokenize ( $title, $language) | |
Tokenize the input $title by generating phrases suited for completion search. | |
Static Public Member Functions | |
static | create (array $config) |
Public Attributes | |
const | SUBPAGE_TYPE = 'subpage' |
@const string subpage type | |
const | STARTS_WITH_ANY_WORDS_TYPE = 'anywords' |
@const string subpage type | |
Protected Member Functions | |
getCharRange () | |
Get the char range used by this builder to split and generate subphrase suggestions. | |
getExtraFields () | |
List of FST fields where the subphrase suggestions will be added. | |
Simple class for SuggestionsBuilder that needs to munge the title into a list of "subphrases" suggestions.
Subphrases are only generated for title, redirects are not yet supported. A set of new fields is used to insert these suggestions 'suggest-extra' is used by default but can be overridden with string[] getExtraFields().
CirrusSearch\BuildDocument\Completion\NaiveSubphrasesSuggestionsBuilder::__construct | ( | $charRange, | |
$maxSubPhrases = self::MAX_SUBPHRASES ) |
string | $charRange | character range used to split subphrases |
int | $maxSubPhrases | defaults to MAX_SUBPHRASES |
CirrusSearch\BuildDocument\Completion\NaiveSubphrasesSuggestionsBuilder::build | ( | array | $inputDoc, |
$suggestType, | |||
$score, | |||
\Elastica\Document | $suggestDoc, | ||
$targetNamespace ) |
mixed[] | $inputDoc | |
string | $suggestType | (title or redirect) |
int | $score | |
\Elastica\Document | $suggestDoc | suggestion type (title or redirect) |
int | $targetNamespace |
Implements CirrusSearch\BuildDocument\Completion\ExtraSuggestionsBuilder.
|
protected |
Get the char range used by this builder to split and generate subphrase suggestions.
|
protected |
List of FST fields where the subphrase suggestions will be added.
CirrusSearch\BuildDocument\Completion\NaiveSubphrasesSuggestionsBuilder::getRequiredFields | ( | ) |
@inheritDoc
Implements CirrusSearch\BuildDocument\Completion\ExtraSuggestionsBuilder.
CirrusSearch\BuildDocument\Completion\NaiveSubphrasesSuggestionsBuilder::splitTranslatedPage | ( | $title, | |
$language ) |
Split a translated page title into an array with the title at offset 0 and the language subpage at offset 1.
e.g. splitTranslatedPage("Hello/en", "en")
string | $title | |
string | $language |
CirrusSearch\BuildDocument\Completion\NaiveSubphrasesSuggestionsBuilder::tokenize | ( | $title, | |
$language ) |
Tokenize the input $title by generating phrases suited for completion search.
e.g. : $title = "Hello Beautifull Word/en"; $builder->tokenize( $title, "en", "\\s" ); will generate the following array: [ "Beautifull Word/en", "Word/en" ]
string | $title | |
string | $language |