Differential D18534 Diff 44513 src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php
Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php
| Show First 20 Lines • Show All 1,491 Lines • ▼ Show 20 Lines | foreach ($this->ferretTokens as $fulltext_token) { | ||||
| if ($raw_token->isQuoted()) { | if ($raw_token->isQuoted()) { | ||||
| $is_stemmed = false; | $is_stemmed = false; | ||||
| } else { | } else { | ||||
| $is_stemmed = true; | $is_stemmed = true; | ||||
| } | } | ||||
| if ($is_substring) { | if ($is_substring) { | ||||
| $ngrams = $engine->getNgramsFromString($value, 'query'); | $ngrams = $engine->getSubstringNgramsFromString($value); | ||||
| } else { | } else { | ||||
| $ngrams = $engine->getNgramsFromString($value, 'index'); | $ngrams = $engine->getTermNgramsFromString($value); | ||||
| // If this is a stemmed term, only look for ngrams present in both the | // If this is a stemmed term, only look for ngrams present in both the | ||||
| // unstemmed and stemmed variations. | // unstemmed and stemmed variations. | ||||
| if ($is_stemmed) { | if ($is_stemmed) { | ||||
| $stem_value = $stemmer->stemToken($value); | $stem_value = $stemmer->stemToken($value); | ||||
| $stem_ngrams = $engine->getNgramsFromString( | $stem_ngrams = $engine->getTermNgramsFromString($stem_value); | ||||
| $stem_value, | |||||
| 'index'); | |||||
| $ngrams = array_intersect($ngrams, $stem_ngrams); | $ngrams = array_intersect($ngrams, $stem_ngrams); | ||||
| } | } | ||||
| } | } | ||||
| foreach ($ngrams as $ngram) { | foreach ($ngrams as $ngram) { | ||||
| $flat[] = array( | $flat[] = array( | ||||
| 'table' => $ngram_table_name, | 'table' => $ngram_table_name, | ||||
| 'ngram' => $ngram, | 'ngram' => $ngram, | ||||
| ▲ Show 20 Lines • Show All 127 Lines • ▼ Show 20 Lines | foreach ($this->ferretTokens as $fulltext_token) { | ||||
| // Never stem negated queries, since this can exclude results users | // Never stem negated queries, since this can exclude results users | ||||
| // did not mean to exclude and generally confuse things. | // did not mean to exclude and generally confuse things. | ||||
| if ($is_not) { | if ($is_not) { | ||||
| $is_stemmed = false; | $is_stemmed = false; | ||||
| } | } | ||||
| $term_constraints = array(); | $term_constraints = array(); | ||||
| $term_value = ' '.$engine->newTermsCorpus($value).' '; | $term_value = $engine->newTermsCorpus($value); | ||||
| if ($is_not) { | if ($is_not) { | ||||
| $term_constraints[] = qsprintf( | $term_constraints[] = qsprintf( | ||||
| $conn, | $conn, | ||||
| '(%T.termCorpus NOT LIKE %~)', | '(%T.termCorpus NOT LIKE %~)', | ||||
| $table_alias, | $table_alias, | ||||
| $term_value); | $term_value); | ||||
| } else { | } else { | ||||
| $term_constraints[] = qsprintf( | $term_constraints[] = qsprintf( | ||||
| $conn, | $conn, | ||||
| '(%T.termCorpus LIKE %~)', | '(%T.termCorpus LIKE %~)', | ||||
| $table_alias, | $table_alias, | ||||
| $term_value); | $term_value); | ||||
| } | } | ||||
| if ($is_stemmed) { | if ($is_stemmed) { | ||||
| $stem_value = $stemmer->stemToken($value); | $stem_value = $stemmer->stemToken($value); | ||||
| $stem_value = $engine->newTermsCorpus($stem_value); | $stem_value = $engine->newTermsCorpus($stem_value); | ||||
| $stem_value = ' '.$stem_value.' '; | |||||
| $term_constraints[] = qsprintf( | $term_constraints[] = qsprintf( | ||||
| $conn, | $conn, | ||||
| '(%T.normalCorpus LIKE %~)', | '(%T.normalCorpus LIKE %~)', | ||||
| $table_alias, | $table_alias, | ||||
| $stem_value); | $stem_value); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 780 Lines • Show Last 20 Lines | |||||