Page MenuHomePhabricator

Show matching context from the document body in ferret search results

Authored by mmodell on Feb 28 2020, 4:08 AM.
Referenced Files
Unknown Object (File)
Apr 9 2023, 9:11 AM
Unknown Object (File)
Mar 15 2023, 1:25 PM
Unknown Object (File)
Mar 4 2023, 1:18 PM
Unknown Object (File)
Mar 4 2023, 11:28 AM
Unknown Object (File)
Feb 27 2023, 10:23 AM
Unknown Object (File)
Feb 21 2023, 2:20 PM
Unknown Object (File)
Feb 20 2023, 5:22 PM
Unknown Object (File)
Feb 15 2023, 12:01 PM


Maniphest Tasks
T230787: Make search context highlights work with the ferret search engine
Patch without arc
git checkout -b D1179 && curl -L | git apply

This is working fairly well, surprisingly.

Note: I've cheated, to get the context I re-build the search document using the indexing code
instead of querying mysql to get it out of the {object-type}_ffields table.
I _think_ this is more efficient than the alternative, however, I may be entirely mistaken.

Bug: T230787
Maniphest-Task: T230787

Test Plan

run a global-search query and look for snippets of the body text, complete with bolded text for any matching terms that appear within the body.

Diff Detail

rPHAB Phabricator
search-context (branched from wmf/stable)
Lint Errors
Error/srv/phab/libext/misc/scripts/init/init-script.php:3PHL3One Class Per File
Error/srv/phab/libext/misc/src/oauth/PhabricatorMediaWikiAuthProvider.php:273PHL1Unknown Symbol
Error/srv/phab/libext/misc/src/other/CustomLoginHandler.php:6PHL1Unknown Symbol
Errorsrc/applications/metamta/adapter/PhabricatorMailImplementationPHPMailerAdapter.php:4PHL1Unknown Symbol
Test Failures
Build Status
Buildable 3281
Build 5442: arc lint + arc unit

Unit TestsFailed

177 msPhabricatorLibraryTestCase::testEverythingImplemented
EXCEPTION (PhutilMissingSymbolException): Failed to load class/interface "PhabricatorMailImplementationPHPMailerAdapter". The symbol map for library "phabricator" (at "/srv/phab/phabricator/src") claims this symbol (of type "class/interface") is defined in "applications/metamta/adapter/PhabricatorMailImplementationPHPMailerAdapter.php", but loading that source file did not cause the symbol to become defined.
363 msPhabricatorLibraryTestCase::testMethodVisibility
EXCEPTION (PhutilMissingSymbolException): Failed to load class or interface "PhabricatorMailImplementationAdapter". The class or interface "PhabricatorMailImplementationAdapter" is not defined in the library map of any loaded library.
154 msPhabricatorCelerityTestCase::testCelerityMaps
1 assertion passed.
11 msPhabricatorConduitTestCase::testConduitMethods
1 assertion passed.
0 msPhabricatorInfrastructureTestCase::testApplicationsInstalled
1 assertion passed.
View Full Test Results (2 Failed · 5 Passed)

Event Timeline

mmodell created this revision.

A couple of nits commented inline. Still working on getting my head around the larger mechanics. What I understand seems pretty reasonable.




Any case this would ever hit something that consists entirely of 0? i.e., should this check something besides truthiness of the $body value itself?

  • Improved context display behavior
  • Improved some comments
  • Now searches the whole body for context instead of trimming to 1200 bytes.
mmodell retitled this revision from WIP: show matching context from the document body in ferret search results to Show matching context from the document body in ferret search results.Apr 8 2020, 5:35 PM
mmodell added a project: Phabricator.
This revision is now accepted and ready to land.Jul 29 2020, 5:13 PM