1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 16:52:41 +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:
vrana 2012-03-14 19:07:24 -07:00
parent 44e3b6883b
commit 5ee1341b97
2 changed files with 11 additions and 1 deletions

View file

@ -46,7 +46,8 @@ final class PhabricatorSearchController
$query_str = $request->getStr('query'); $query_str = $request->getStr('query');
$pref_jump = PhabricatorUserPreferences::PREFERENCE_SEARCHBAR_JUMP; $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); $response = PhabricatorJumpNavHandler::jumpPostResponse($query_str);
} else { } else {
$response = null; $response = null;
@ -156,6 +157,14 @@ final class PhabricatorSearchController
$search_form $search_form
->setUser($user) ->setUser($user)
->setAction('/search/') ->setAction('/search/')
->appendChild(
phutil_render_tag(
'input',
array(
'type' => 'hidden',
'name' => 'jump',
'value' => 'no',
)))
->appendChild( ->appendChild(
id(new AphrontFormTextControl()) id(new AphrontFormTextControl())
->setLabel('Search') ->setLabel('Search')

View file

@ -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/form/control/tokenizer');
phutil_require_module('phabricator', 'view/layout/panel'); phutil_require_module('phabricator', 'view/layout/panel');
phutil_require_module('phutil', 'markup');
phutil_require_module('phutil', 'utils'); phutil_require_module('phutil', 'utils');