Skip to content

Add single-query search using the optimised model - #12

Merged
4ment merged 5 commits into
mainfrom
feature/search
Sep 28, 2026
Merged

4ment merged 5 commits into
mainfrom
feature/search

Conversation

@4ment

@4ment 4ment commented Sep 27, 2026

Copy link
Copy Markdown
Owner

Summary

Implement single-query search using the optimised entity-linkage model.

Given a query record, the search uses the fitted model to identify and rank the most likely matching records in the reference dataset.

Changes

  • Add support for searching using a single query record.
  • Use the optimised model to generate and score candidate matches.
  • Rank results by model score.
  • Return comparison information for each match.
  • Support configurable matching thresholds.
  • Avoid loading the full dataset for each query.

Testing

  • Test searches against known records with expected matches.
  • Verify model scores and ranking.
  • Test queries with no matches.
  • Test configurable matching thresholds.
  • Test performance on a representative dataset.

4ment and others added 4 commits September 23, 2026 19:58
- Introduced `search.hpp` with definitions for query handling, search options, and search reports.
- Implemented `Searcher` class for executing searches against a record store.
- Added `QueryField` and `QueryRecord` structures to represent search queries.
- Implemented `ParseQueryField` function for parsing query strings.
- Added `SearchOptions` and `SearchReport` structures to manage search configurations and results.
- Implemented `PrintSearchReport` and `SearchReportJson` functions for reporting search results.
- Added `GroupHitsByCluster` function to label search hits by their respective clusters.
- Extended `SignatureTable` in `signature.cpp` to accommodate dynamic dictionary sizes.
- Created comprehensive unit tests for search functionality in `search_test.cpp`, covering various scenarios and edge cases.
A common exact name could rank below a typo of it, because only the exact
level was term-frequency adjusted. `cpplink search` gains --fuzzy-tf and
--ball-budget, and `Linker.search` takes tf_damping and fuzzy_tf.

Search measures the query's own neighbourhood mass from the dictionary walk
and pins it on the scorer, so an adopted value is adjusted too (it read past
the end of the table before) and a stored value scores what predict would.
The mass is clamped to the table's range to keep the bracket admissible.
Neighbourhood tables are built only for the comparisons the query names and
the Python session keeps them.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@4ment 4ment linked an issue Sep 27, 2026 that may be closed by this pull request
search_test.cpp used std::log2 without including <cmath>, which libc++
provides transitively and libstdc++ does not.

Check(f(&error), "stage: " + error) left the order of its two arguments
to the compiler, and MSVC built the message before f had written the
error, so the Python binding raised 'search: ' with no reason. A Check
overload taking the prefix separately defers the concatenation until
after the call; the five search, rescore and simplify sites use it.
@4ment
4ment merged commit e60cf82 into main Sep 28, 2026
12 checks passed
4ment added a commit that referenced this pull request Sep 28, 2026
Add search functionality and related structures

- Introduced `search.hpp` with definitions for query handling, search options, and search reports.
- Implemented `Searcher` class for executing searches against a record store.
- Added `QueryField` and `QueryRecord` structures to represent search queries.
- Implemented `ParseQueryField` function for parsing query strings.
- Added `SearchOptions` and `SearchReport` structures to manage search configurations and results.
- Implemented `PrintSearchReport` and `SearchReportJson` functions for reporting search results.
- Added `GroupHitsByCluster` function to label search hits by their respective clusters.
- Extended `SignatureTable` in `signature.cpp` to accommodate dynamic dictionary sizes.
- Created comprehensive unit tests for search functionality in `search_test.cpp`, covering various scenarios and edge cases.
@4ment
4ment deleted the feature/search branch September 28, 2026 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add single-query search functionality

1 participant