Page MenuHomePhabricator

Select Ferret fulltext columns in results so fulltext queries work under UNION
ClosedPublic

Authored by epriestley on Mar 18 2019, 11:07 PM.
Tags
None
Referenced Files
F14085044: D20297.diff
Sat, Nov 23, 10:36 AM
F14081227: D20297.id48452.diff
Fri, Nov 22, 6:50 PM
Unknown Object (File)
Fri, Nov 22, 4:45 AM
Unknown Object (File)
Mon, Nov 18, 3:09 AM
Unknown Object (File)
Thu, Nov 14, 6:41 AM
Unknown Object (File)
Mon, Nov 11, 4:55 AM
Unknown Object (File)
Sat, Nov 9, 8:21 PM
Unknown Object (File)
Sat, Nov 9, 3:30 PM
Subscribers
None

Details

Summary

Ref T13091. In Differential, if you provide a query and "Sort by: Relevance", we build a query like this:

((SELECT revision.* FROM ... ORDER BY rank) UNION ALL (SELECT revision.* FROM ... ORDER BY rank)) ORDER BY rank

The internal "ORDER BY rank" is technically redundant (probably?), but doesn't hurt anything, and makes construction easier.

The problem is that the outer "ORDER BY rank" at the end, which attempts to order the results of the two parts of the UNION, can't actually order them, since rank wasn't selected.

(The column isn't actually "rank", which is selected -- it's the document modified/created subcolumns, which are not.)

To fix this, actually select the fulltext columns into the result set.

Test Plan
  • Ran a non-empty fulltext query in Differential with "Bucket: Required Action" selected so the UNION construction fired.
  • Ran normal queries in Maniphest and global search.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This revision is now accepted and ready to land.Mar 18 2019, 11:14 PM
  • Remove the created/modified properties from the raw result row (this is just housekeeping, I don't believe it affects anything).
  • Move the _ft_magic strings to class constants (more housekeeping).
  • Add a small explanatory comment pointing here.
This revision was automatically updated to reflect the committed changes.