Add default-operator option (#59)
* Add default-operator option Add a --default-operator flag controlling how adjacent query terms with no explicit AND/OR between them are combined. The default remains "and" (a file must contain every term); "or" matches any term, which is useful for tools and agents that issue broad multi-keyword queries where the default AND is often too restrictive and returns zero results. The operator flows through DoSearch to the query parser, so all modes (console, TUI, HTTP, MCP) honour it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Filters apply to the whole query under --default-operator=or With a default-or operator, a query like "foo bar path:pkg" parses as "foo OR bar OR path:pkg", which unexpectedly OR's the path filter with the keywords instead of constraining the results. Users expect metadata filters (path:, ext:, file:, lang:, complexity:, ...) to apply to the whole query. Tag OR nodes created from adjacent terms as implicit, then hoist filters out of implicit-OR groupings and AND them at the top, so "foo bar path:pkg" becomes "(foo OR bar) AND path:pkg". Explicit "foo OR path:pkg" and negated filters are left untouched. Hoisting also runs when a parenthesised group closes, which confines a filter to its group: "(foo path:pkg) bar" becomes "(foo AND path:pkg) OR bar" while a top-level filter still applies across the whole query. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
J
John Buckley committed
e04ab11683c408ec1f1a14aa9dcbf720e376abe5
Parent: 5d71017
Committed by GitHub <noreply@github.com>
on 7/14/2026, 2:44:23 AM