mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-27 07:50:57 +01:00
Be able to search for Differential and other short strings
Summary: I wanted to search for D1234 in texts of other documents. But search tool always redirects me. I've left the redirect behavior for simple search forms (header and home) and removed it from full search form. I don't consider this complete because the first result in search for D1234 should be of course D1234 which is not the case currently. I am not sure how to solve it: - We can display a special result in this case. - We can index the documents so that they will be searchable also for short strings. I tend to use the first solution because revisions can be truncated at arbitrary length (rX1f1f1f should display revision rX1f1f1f1f1f1f1f). Test Plan: Search for D1234, rX123, T4. Reviewers: epriestley Reviewed By: epriestley CC: aran, epriestley, ddfisher Differential Revision: https://secure.phabricator.com/D1905
This commit is contained in:
parent
44e3b6883b
commit
5ee1341b97
2 changed files with 11 additions and 1 deletions
|
@ -46,7 +46,8 @@ final class PhabricatorSearchController
|
|||
$query_str = $request->getStr('query');
|
||||
|
||||
$pref_jump = PhabricatorUserPreferences::PREFERENCE_SEARCHBAR_JUMP;
|
||||
if ($user && $user->loadPreferences()->getPreference($pref_jump, 1)) {
|
||||
if ($request->getStr('jump') != 'no' &&
|
||||
$user && $user->loadPreferences()->getPreference($pref_jump, 1)) {
|
||||
$response = PhabricatorJumpNavHandler::jumpPostResponse($query_str);
|
||||
} else {
|
||||
$response = null;
|
||||
|
@ -156,6 +157,14 @@ final class PhabricatorSearchController
|
|||
$search_form
|
||||
->setUser($user)
|
||||
->setAction('/search/')
|
||||
->appendChild(
|
||||
phutil_render_tag(
|
||||
'input',
|
||||
array(
|
||||
'type' => 'hidden',
|
||||
'name' => 'jump',
|
||||
'value' => 'no',
|
||||
)))
|
||||
->appendChild(
|
||||
id(new AphrontFormTextControl())
|
||||
->setLabel('Search')
|
||||
|
|
|
@ -27,6 +27,7 @@ phutil_require_module('phabricator', 'view/form/control/text');
|
|||
phutil_require_module('phabricator', 'view/form/control/tokenizer');
|
||||
phutil_require_module('phabricator', 'view/layout/panel');
|
||||
|
||||
phutil_require_module('phutil', 'markup');
|
||||
phutil_require_module('phutil', 'utils');
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue