Page MenuHomePhabricator

Provide some "term vs substring" support for the Ferret engine

Authored by epriestley on Aug 30 2017, 4:29 PM.
Referenced Files
Unknown Object (File)
Mon, Jul 4, 2:28 AM
Unknown Object (File)
Fri, Jun 24, 3:23 AM
Unknown Object (File)
Tue, Jun 21, 10:42 PM
Unknown Object (File)
Sun, Jun 19, 3:22 PM
Unknown Object (File)
Wed, Jun 15, 10:39 PM
Unknown Object (File)
Tue, Jun 14, 12:23 AM
Unknown Object (File)
Mon, Jun 13, 1:17 PM
Unknown Object (File)
Jun 5 2022, 12:19 PM



Ref T12819. Distinguishes between "term" queries and "substring" queries, and tries to match them correctly most of the time. For example:

  • example matches "example", obviously.
  • ~amp matches "example", but amp does not.
  • examples matches "example" through stemming.
  • "examples" does not match "example" (quoted text does not stem).
  • "an examp" does not match "an example" (quoted text is still term text).
  • ~"an examp" matches "an example" (quoted, substring-operator text uses substring search).
Test Plan

Ran searches similar to the above, they seemed to do what they should.

Diff Detail

rP Phabricator
Lint Not Applicable
Tests Not Applicable

Event Timeline

The code is pretty hacks-upon-hacks, but I'm still not really sure if this is a viable pathway forward or not so I'm trying to get it all working before I clean it up. Stuff I still have to do:

  • Make title: work (search only the title field).
  • Make dog -blue (negated terms) work.

Then we can bang on it a bit and see if it falls over. If it seems like it's going to hold, I'll clean things up a bit so the code, e.g., isn't adding random spaces to things for no apparent reason in 50 different places (the spaces are "magic").

I believe this is the right path forward, though the road may be bumpy.

This revision is now accepted and ready to land.Aug 30 2017, 4:40 PM
This revision was automatically updated to reflect the committed changes.