1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 23:02:42 +01:00

By default, do not save queries when executing Conduit "*.search" calls

Summary:
Fixes T11304. Prior to this change, we did an unnecessary write on every "*.search" call (this write didn't always actually write a row, since we only save //unique// saved queries, but still doesn't do anything useful ever, currently).

Instead, change this to not-write by default. We could add an "oh, and also I want you to do a write" option later, which would let us implement something like `arc query-stuff` which says "To see more results, view this URI in your browser: ...".

(It's possible to run one of these methods with an existing SavedQuery by using the key, so we still sometimes have a queryKey to return.)

Test Plan: Ran `almanac.service.search`, used DarkConsole to verify that no serachengine writes occurred.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11304

Differential Revision: https://secure.phabricator.com/D16263
This commit is contained in:
epriestley 2016-07-09 06:47:32 -07:00
parent d44a5fa933
commit c21be4849f

View file

@ -1160,7 +1160,11 @@ abstract class PhabricatorApplicationSearchEngine extends Phobject {
$saved_query->setParameter($field->getKey(), $value);
}
$this->saveQuery($saved_query);
// NOTE: Currently, when running an ad-hoc query we never persist it into
// a saved query. We might want to add an option to do this in the future
// (for example, to enable a CLI-to-Web workflow where user can view more
// details about results by following a link), but have no use cases for
// it today. If we do identify a use case, we could save the query here.
$query = $this->buildQueryFromSavedQuery($saved_query);
$pager = $this->newPagerForSavedQuery($saved_query);
@ -1234,6 +1238,7 @@ abstract class PhabricatorApplicationSearchEngine extends Phobject {
'data' => $data,
'maps' => $method->getQueryMaps($query),
'query' => array(
// This may be `null` if we have not saved the query.
'queryKey' => $saved_query->getQueryKey(),
),
'cursor' => array(