Upgrade Search with RapidFuzz & Structured Filter Extraction #10
+151
−45
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.
This PR enhances the KnowledgeSpace search pipeline by improving both performance and query understanding.
The existing string-matching logic has been replaced with RapidFuzz for faster and more accurate fuzzy matching. In addition, an LLM-based query parsing step has been introduced to extract structured metadata filters from natural language queries. This allows the search system to move beyond raw keyword matching and return more relevant results from sources such as EBRAINS and OpenNeuro.
Key Changes
Switched to RapidFuzz for fuzzy matching
difflibwith RapidFuzz.LLM-based filter extraction
Examples:
"EEG data"→{ "technique": "EEG" }"MRI data for Alzheimer's"→{ "modality": "MRI", "disease": "Alzheimer's" }Bug fix in
KSSearchAgentKSSearchAgentthat could result in incomplete results under certain input conditions.Testing & Verification
Test query:
"EEG data"technique = EEG).For testing purposes
Tested locally with queries like “EEG data”. Filters were correctly extracted and relevant EEG datasets from EBRAINS and OpenNeuro were ranked higher and within 4sec response.