@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.

Support the Ferret "=" (exact match) operator in the actual query engine

Summary:
Ref PHI778. In D18492, I added support for parsing this operator, but did not actually implement it in the query engine.

Implementation is fairly straightforward. This supports querying for objects by exact title with `title:="exact title"`. This is probably a bad idea, but sometimes maybe useful anyway.

Test Plan: Queried for `title:="xxx"`, found only exact matches.

Reviewers: amckinley

Reviewed By: amckinley

Subscribers: ahoffer2

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

+25
+4
src/applications/search/query/PhabricatorFulltextToken.php
··· 60 60 $tip = pht('Substring Search'); 61 61 $shade = PHUITagView::COLOR_VIOLET; 62 62 break; 63 + case PhutilSearchQueryCompiler::OPERATOR_EXACT: 64 + $tip = pht('Exact Search'); 65 + $shade = PHUITagView::COLOR_GREEN; 66 + break; 63 67 default: 64 68 $shade = PHUITagView::COLOR_BLUE; 65 69 break;
+1
src/applications/search/view/PhabricatorSearchResultView.php
··· 84 84 85 85 switch ($operator) { 86 86 case PhutilSearchQueryCompiler::OPERATOR_SUBSTRING: 87 + case PhutilSearchQueryCompiler::OPERATOR_EXACT: 87 88 $patterns[] = '(('.preg_quote($value).'))ui'; 88 89 break; 89 90 case PhutilSearchQueryCompiler::OPERATOR_AND:
+20
src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php
··· 1918 1918 1919 1919 $op_sub = PhutilSearchQueryCompiler::OPERATOR_SUBSTRING; 1920 1920 $op_not = PhutilSearchQueryCompiler::OPERATOR_NOT; 1921 + $op_exact = PhutilSearchQueryCompiler::OPERATOR_EXACT; 1921 1922 1922 1923 $where = array(); 1923 1924 $current_function = 'all'; ··· 1939 1940 $is_substring = true; 1940 1941 } else { 1941 1942 $is_substring = false; 1943 + } 1944 + 1945 + // If we're doing exact search, just test the raw corpus. 1946 + $is_exact = ($raw_token->getOperator() == $op_exact); 1947 + if ($is_exact) { 1948 + if ($is_not) { 1949 + $where[] = qsprintf( 1950 + $conn, 1951 + '(%T.rawCorpus != %s)', 1952 + $table_alias, 1953 + $value); 1954 + } else { 1955 + $where[] = qsprintf( 1956 + $conn, 1957 + '(%T.rawCorpus = %s)', 1958 + $table_alias, 1959 + $value); 1960 + } 1961 + continue; 1942 1962 } 1943 1963 1944 1964 // If we're doing substring search, we just match against the raw corpus