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
F14103640: D20297.diff
Tue, Nov 26, 10:21 PM
F14102069: D20297.diff
Tue, Nov 26, 5:46 PM
F14101047: D20297.id48452.diff
Tue, Nov 26, 3:45 PM
F14101046: D20297.id48444.diff
Tue, Nov 26, 3:45 PM
F14101044: D20297.id48442.diff
Tue, Nov 26, 3:45 PM
F14101043: D20297.id.diff
Tue, Nov 26, 3:45 PM
Unknown Object (File)
Sat, Nov 23, 5:13 PM
Unknown Object (File)
Sat, Nov 23, 10:36 AM
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.