@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix an issue with selecting the right stemmed ngrams with Ferret engine queries

Summary:
Ref T12819. In D18581, I corrected one bug (ngram selection for terms) but introduced a minor new bug. We now pass `' query '` (term corpus with boundary spaces) to the stemmer, but it bails out on this since English words don't start with spaces.

Trim these extra boundary spaces off before invoking the stemmer.

The practical effect of this is that searching for non-stem variations of a word ("detection") now finds stemmed variations again ("detect"). Prior to fixing this bug, the stem could find longer variations but not the other way around.

Test Plan: Searched for "detection", found results matching "detect" after patch (and saw same results for "detect" and "detection").

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12819

Differential Revision: https://secure.phabricator.com/D18593

+3
+3
src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php
··· 1683 1683 // If this is a stemmed term, only look for ngrams present in both the 1684 1684 // unstemmed and stemmed variations. 1685 1685 if ($is_stemmed) { 1686 + // Trim the boundary space characters so the stemmer recognizes this 1687 + // is (or, at least, may be) a normal word and activates. 1688 + $terms_value = trim($terms_value, ' '); 1686 1689 $stem_value = $stemmer->stemToken($terms_value); 1687 1690 $stem_ngrams = $engine->getTermNgramsFromString($stem_value); 1688 1691 $ngrams = array_intersect($ngrams, $stem_ngrams);