1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-15 11:22:40 +01:00
phorge-phorge/src/applications/search
epriestley 07082d2867 Don't allow empty list constraints in Conduit calls
Summary:
Ref T11473. If you write a method like `get_stuff(ids)` and then call it with an empty list of IDs, you can end up passing an empty constraint to Conduit.

If you run a `*.search` method with such a constraint, like this one:

```
{
  "ids": []
}
```

...we have three possible beahviors:

  # Treat it like the user passed no constraint (basically, ignore the constraint).
  # Respect the constraint (return no results).
  # Error.

Currently, we do (1). However, this is pretty confusing and I think clearly the worst option, since it means `get_stuff(array())` in client code will often tend to return a ton of results.

We could do (2) instead, but this is also sort of confusing (it may not be obvious why nothing matched, even though it's an application bug) and I think most reasonable client code should be doing an `if ($ids)` test: this test makes clients a little more complicated, but they can save a network call, and I think they often need to do this test anyway (for example, to show the user a different message).

This implements (3), and just considers these to be errors: this is the least tricky behavior, it's consistent with what we do in PHP, makes fairly good sense, and the only cost for this is that client code may need to be slightly more complex, but this slightly more complex code is usually better code.

Test Plan: Ran Conduit `*.search` queries with `"ids":[]` and `"phids":[]`, got sensible errors instead of runaway result sets.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11473

Differential Revision: https://secure.phabricator.com/D16396
2016-08-14 08:31:13 -07:00
..
application Convert Maniphest merge operations to modern Relationship code 2016-06-30 08:35:45 -07:00
applicationpanel Rename "SearchEngine" to "FulltextStorageEngine" 2015-12-21 17:26:19 -08:00
buckets Use new Differential bucketing logic on default (non-dashboard) homepage 2016-05-19 15:20:39 -07:00
config Move FontIcon calls to Icon 2016-01-28 08:48:45 -08:00
constants Extend from Phobject 2015-06-15 18:02:27 +10:00
controller Redesign Application Search 2016-08-01 12:23:36 -07:00
editor Update EditEngine for two column 2016-03-28 09:18:55 -07:00
engine Allow *.search Conduit API methods to have data bulk-loaded by extensions 2016-07-31 11:15:18 -07:00
engineextension Allow *.search Conduit API methods to have data bulk-loaded by extensions 2016-07-31 11:15:18 -07:00
field Don't allow empty list constraints in Conduit calls 2016-08-14 08:31:13 -07:00
fulltextstorage Rename "SearchEngine" to "FulltextStorageEngine" 2015-12-21 17:26:19 -08:00
index Allow index extensions to skip indexing if the object has not changed 2015-12-21 17:27:14 -08:00
interface Prepare Profile Panels for adoption in other applications 2016-01-15 09:12:53 -08:00
management Rename "SearchEngine" to "FulltextStorageEngine" 2015-12-21 17:26:19 -08:00
ngrams Implement basic ngram search for Owners Package names 2015-12-22 08:00:33 -08:00
phidtype Fix a bad getURI() call in Profile Panel handle construction 2016-07-07 14:55:47 -07:00
profilepanel Explain reasoning behind kitty gifts 2016-08-06 06:26:15 -07:00
query Use "tag" more consistenty when referring to associating a project with an object 2016-01-24 10:02:42 -08:00
relationship Render parent and child tasks in Maniphest with a graph trace 2016-07-01 10:41:07 -07:00
storage Refine available filters and defaults for relationship selection 2016-06-30 11:51:36 -07:00
typeahead Render browse results with global result style 2016-06-20 16:49:02 -07:00
view Provide better headers and crumbs for Calendar result views 2016-07-27 09:44:56 -07:00
worker Convert all "DocumentIndexers" into "FulltextEngines" 2015-12-21 17:25:23 -08:00