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
Unknown Object (File)
Sat, Nov 30, 10:31 AM
Unknown Object (File)
Thu, Nov 28, 5:32 PM
Unknown Object (File)
Tue, Nov 26, 10:21 PM
Unknown Object (File)
Tue, Nov 26, 5:46 PM
Unknown Object (File)
Tue, Nov 26, 3:45 PM
Unknown Object (File)
Tue, Nov 26, 3:45 PM
Unknown Object (File)
Tue, Nov 26, 3:45 PM
Unknown Object (File)
Tue, Nov 26, 3:45 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
Branch
cursor7
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 22306
Build 30511: Run Core Tests
Build 30510: arc lint + arc unit

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.