clone

a personal forge on plain git: static pages, stacked-diff reviews, signed local ci, repo sites and releases

Match quoted phrases in every search section #3

4 files changed, +25 -9
MREADME.md8++++++--
Msite/assets/codesearch.ts3++-
Msite/assets/query.ts14++++++++------
Mtest/scenarios/search-phrases.sh9+++++++++
M README.md +6 -2
@@ -540,7 +540,9 @@ are cut to 240 characters and wiki pages to 2000, to keep the index small.
540540 541541 Every section reads a query the same way (`site/assets/query.ts`): terms542542 split on whitespace, in any order, and a quoted phrase (`"fix the search"`)543-is one term, spaces and all, that must appear as written. Every term must543+is one term, spaces and all, that must appear as written, except that a run544+of whitespace in it counts as one space, as in the indexes, which collapse545+whitespace (`"fix the"` is `"fix the"`). Every term must544546 match, ignoring case, and results mark each match, a phrase as a whole. A545547 quote opens a phrase only at the start of a term (in `it's"` it is just a546548 character), an unclosed quote runs to the end of the query as a phrase, so a
@@ -567,7 +569,9 @@ goes to a worker, and a Code section lists each line that has every word,
567569 ignoring case, as `path:line`, linked to that line of the file's page (the568570 source page for markdown). Its words are the terms the other sections read,569571 so a quoted phrase (`"import fs from"`) is one literal string, spaces and570-all; a word inside another goes, since a line with the longer one has it.572+all, a run of whitespace as one space as everywhere (so it won't find code573+aligned with several spaces); a word inside another goes, since a line with574+the longer one has it.571575 Words of 3 characters or more are looked up572576 in the index; shorter ones only filter the lines it finds. It loads nothing573577 until then: the first code query starts the worker, which loads
M site/assets/codesearch.ts +2 -1
M site/assets/query.ts +8 -6
M test/scenarios/search-phrases.sh +9 -0