Skip to content

Conversation

@myieye
Copy link
Collaborator

@myieye myieye commented Feb 10, 2026

The updated test cases demonstrate the intention of this PR.

We got the feedback:

filtering for 'tan' gave entries: Antan, matan, tana', tanam, tanan ... and I wondered why Antan and matan were listed before tana', tanam, tanan? If the user thinks they know the beginning of the word, then shouldn't those entries come first? Then other words with 'tan' in them?

@coderabbitai
Copy link

coderabbitai bot commented Feb 10, 2026

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR introduces diacritic-aware prefix matching functionality to complement existing contains matching. It adds StartsWithDiacriticMatch and ContainsDiacriticMatch methods to string utilities, registers a new SQLite StartsWith function, updates sorting logic to prioritize prefix matches, enhances the search service with a new FilterAndRank method, and adjusts test expectations to reflect the new ranking behavior.

Changes

Cohort / File(s) Summary
String matching utilities
backend/FwLite/MiniLcm/Culture/StringExtensions.cs, backend/FwLite/LcmCrdt/SqlHelpers.cs
Replaced public Contains method with ContainsDiacriticMatch and StartsWithDiacriticMatch for diacritic-aware string matching. Added StartsWithIgnoreCaseAccents SQL expression method to SqlHelpers with diacritic-insensitive semantics.
SQLite function registration
backend/FwLite/LcmCrdt/Data/CustomSqliteFunctionInterceptor.cs
Renamed RegisterContainsFunction to RegisterCustomFunctions, added new StartsWithFunction constant and implementation, introduced DiacriticMatchOptions helper for determining comparison options based on diacritic presence.
Sorting and ranking logic
backend/FwLite/FwDataMiniLcmBridge/Api/Sorting.cs, backend/FwLite/LcmCrdt/Data/Sorting.cs, backend/FwLite/LcmCrdt/FullTextSearch/EntrySearchService.cs
Added prefix-match ranking clauses to sorting logic in both Sorting files. Added new public FilterAndRank method to EntrySearchService with multi-criteria ordering: headword matches, then prefix matches, then length/text, with FTS rank and ID tiebreakers. Updated FilterProjection record to include HeadwordPrefixMatches flag.
Test expectations
backend/FwLite/MiniLcm.Tests/QueryEntryTestsBase.cs
Updated test data expectations for att-related cases to reflect new prefix-based ranking order: changed from att,zatt,attack,battery,rap to att,attack,zatt,battery,rap.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

💻 FW Lite

Suggested reviewers

  • imnasnainaec

Poem

🐰 A rabbit hops through prefix dreams,
Where matches dance in diacritic streams,
No accent marks can hide from sight,
With StartsWith bringing ranking might! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 26.32% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: prioritizing prefix matches above other contain matches in sorting, which directly aligns with the PR's primary objective and all modified files.
Description check ✅ Passed The description relates to the changeset by explaining the motivation behind the sorting changes with user feedback about prefix matches being prioritized.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch sort-prefix-matches-before-other-contain-matches

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added the 💻 FW Lite issues related to the fw lite application, not miniLcm or crdt related label Feb 10, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 10, 2026

UI unit Tests

  1 files  ±0   50 suites  ±0   23s ⏱️ -1s
138 tests ±0  138 ✅ ±0  0 💤 ±0  0 ❌ ±0 
203 runs  ±0  203 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit e9ceb65. ± Comparison against base commit a43a321.

♻️ This comment has been updated with latest results.

@argos-ci
Copy link

argos-ci bot commented Feb 10, 2026

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ✅ No changes detected - Feb 10, 2026, 3:43 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💻 FW Lite issues related to the fw lite application, not miniLcm or crdt related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant