Skip to content

Commit 09d18df

Browse files
jesserobbinsclaudewesm
authored
Fix search performance regression and TUI race condition (#262)
Tested and ran into a bunch of performance & context issues that surfaced in the TUI. Original approach using ILIKE is better it seems like for large archives. (Note this is a resubmission of #256) Changes - Reverts DuckDB text search from regexp_matches to ILIKE — regexp caused significant performance regression on Parquet scans. ILIKE is natively optimized by DuckDB for columnar data. FTS5 deep search path is unchanged. - Fixes a TUI race condition where pressing a (all messages) then quickly searching could cause the stale loadMessages response to overwrite search results. Search now invalidates pending loads via loadRequestID. - Fixes a placeholder/arg count drift in buildStatsSearchConditions — text terms emit 4 args each (subject + snippet + 2 sender) but the arg-slicing helper assumed 3. Extracted buildNonTextSearchConditions to eliminate the brittle offset math entirely. Regression tests lock the placeholder invariant across both search builders. --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Wes McKinney <wesmckinn+git@gmail.com>
1 parent 82b1498 commit 09d18df

File tree

6 files changed

+792
-107
lines changed

6 files changed

+792
-107
lines changed

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ LDFLAGS := -X github.com/wesm/msgvault/cmd/msgvault/cmd.Version=$(VERSION) \
1212

1313
LDFLAGS_RELEASE := $(LDFLAGS) -s -w
1414

15-
.PHONY: build build-release install clean test test-v fmt lint lint-ci tidy shootout run-shootout install-hooks help
15+
.PHONY: build build-release install clean test test-v fmt lint lint-ci tidy shootout run-shootout install-hooks bench help
1616

1717
# Build the binary (debug)
1818
build:
@@ -92,6 +92,10 @@ install-hooks:
9292
tidy:
9393
go mod tidy
9494

95+
# Run benchmarks (query engine smoke test)
96+
bench:
97+
go test -tags fts5 -run=^$$ -bench=. -benchtime=1s -count=1 ./internal/query/
98+
9599
# Build the MIME shootout tool
96100
shootout:
97101
CGO_ENABLED=1 go build -o mimeshootout ./scripts/mimeshootout
@@ -117,5 +121,6 @@ help:
117121
@echo " install-hooks - Install pre-commit hook via prek"
118122
@echo " clean - Remove build artifacts"
119123
@echo ""
124+
@echo " bench - Run query engine benchmarks"
120125
@echo " shootout - Build MIME shootout tool"
121126
@echo " run-shootout - Run MIME shootout"

0 commit comments

Comments
 (0)