Page MenuHomePhabricator

*.search Conduit API methods with invalid constraints silently ignore the constraints
Closed, ResolvedPublic

Description

Version

Summary

Queries that utilize link and text custom fields seem to not be filtering properly using constraints via conduit maniphest.search.
The below query returns all tasks, instead of only those that match. I'd expect only task 1 should be returned (since it matches the full string passed in)

Reproduction Steps

  1. Add custom field of either link or text type.
{
  "trac-url": {
    "name": "Trac Ticket",
    "type": "link",
    "caption": "Linked trac ticket",
    "required": false,
    "search": true
  }
}
  1. Add 2 tasks. On one, fill out the Trac Ticket field. On the other, leave it empty. The URL doesn't matter.
  2. Call maniphest.search with this, using the bogus URL from step 2.
{
  "custom.trac-url": [
    "https://mysite.com/project/ticket/1"
  ]
}
  1. Response includes multiple tasks instead of only the one that matches the URL.

For completeness, see Q475: maniphest.search with "link" custom fields doesn't seem to work for my original use-case and example.

Event Timeline

jonathanrseawright renamed this task from maniphest.search with link/text constraints return all tasks, instead of ony to maniphest.search with link/text constraints return all tasks, instead of the ones that match.Sep 5 2016, 3:52 PM
jonathanrseawright created this task.

Does this work?

{
  "custom.trac-url": "https://mysite.com/project/ticket/1"
}

Nope, that doesn't work either..

Alright, thanks. I'll look at this in more detail.

Sounds good. Let me know how I can help

Oh, this isn't expected to work. These don't currently expose a constraint. You can find an exhaustive list of constraints in the "Custom Query Constraints" table on the API page, and no constraint will be listed for these fields.

I'll change *.search methods to fail explicitly if an invalid constraint is provided.

epriestley renamed this task from maniphest.search with link/text constraints return all tasks, instead of the ones that match to *.search Conduit API methods with invalid constraints silently ignore the constraints.Sep 6 2016, 11:26 PM
  • text does not support searching, and does not claim to support searching (e.g., is not listed on "Constraints"). The intent is to eventually expose fulltext/content search here rather than exact-match search.
  • We did not validate constraint keys, so it would appear that we might support searching on invalid constraints. D16507 fixes this: we now throw an explicit exception pointing at the error.
  • link does support searching, but did not handle query constraints correctly. D16508 fixes this, and it now should apply these constraints properly.

I believe all that stuff is fixed in HEAD of master, let us know if you're still seeing issues (other than text not being searchable: it isn't currently supported). Thanks for the report!