feat(search): embedding-only semantic highlight + native-image dense fix#88
Merged
Conversation
- Replace dictionary-based smart highlight with embedding-based semantic passages: semanticSpan() picks the passage closest in meaning to the query; semanticFind() runs a book-scoped dense KNN for smart find-in-page - Remove buildHighlightTerms (dictionary expansion) from the engine - VectorSearcher: open the index with NIOFSDirectory under GraalVM native image (MMapDirectory's MemorySegmentIndexInputProvider can't load there), matching LuceneSearchEngine — fixes dense search + highlight being silently disabled - fuse(): degrade to lexical-only (and log) instead of throwing if dense fails - denseReady() to warm/probe the dense backend
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
semanticSpan(query, text)returns the contiguous passage closest in meaning to the query (same v5 encoder as dense search);semanticFind(query, bookId, limit)runs a book-scoped dense KNN for smart find-in-page.buildHighlightTerms(dictionary-based) from the engine.VectorSearchernow opens the Lucene index withNIOFSDirectoryunder GraalVM native image (MMapDirectory'sMemorySegmentIndexInputProvideruses Panama foreign downcalls that can't be instantiated there →LinkageError), mirroringLuceneSearchEngine. Without this, dense search + highlight were silently disabled in the native binary and the engine fell back to lexical+dictionary.fuse()degrades to lexical-only (with a log) instead of throwing when the dense backend fails;denseReady()warms/probes the dense backend.Test plan
:searchcompilesdenseReady=true, smart find returns hits, passages highlighted