Skip to content

Search: allow typos when searching by string#20660

Open
SkySkimmer wants to merge 1 commit into
rocq-prover:masterfrom
SkySkimmer:search-fuzzy
Open

Search: allow typos when searching by string#20660
SkySkimmer wants to merge 1 commit into
rocq-prover:masterfrom
SkySkimmer:search-fuzzy

Conversation

@SkySkimmer

Copy link
Copy Markdown
Contributor

For experimentation I set to to require exact substring match when the searched string has length <= 4, and allow edit distance <= 2 otherwise. These 2 numbers could be turned into user-settable options.

IDK if these are good defaults.

Also not sure if constant ints is the right way to work. eg with longer input strings we may want to allow more typos so maybe 2 should be min 2 (2% of input string length) or some such thing.

Probably needs user feedback to progress.

(also no idea how performant this is)

@SkySkimmer SkySkimmer added the request: full CI Use this label when you want your next push to trigger a full CI. label May 20, 2025
@coqbot-app coqbot-app Bot removed the request: full CI Use this label when you want your next push to trigger a full CI. label May 20, 2025
@yannl35133

Copy link
Copy Markdown
Contributor

How about ⌊(n + 4) / 8⌋ (0 when <= 4, then +1 every 8 characters in length) ?
Also, is the dbg function still expected to be in here?

@SkySkimmer

Copy link
Copy Markdown
Contributor Author

That's the same as round(n / 8) right?

@SkySkimmer SkySkimmer added the request: full CI Use this label when you want your next push to trigger a full CI. label May 20, 2025
@coqbot-app coqbot-app Bot removed the request: full CI Use this label when you want your next push to trigger a full CI. label May 20, 2025
@yannl35133

Copy link
Copy Markdown
Contributor

That's the same as round(n / 8) right?

It would need to round 0.5 down, but except for that yes. My suggestion was also meant to be implemented as (n + 4) asr 3, so that it's only about integers and takes no time to compute.

@coqbot-app coqbot-app Bot added the needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. label May 21, 2025
@SkySkimmer SkySkimmer marked this pull request as ready for review March 31, 2026 14:02
@SkySkimmer SkySkimmer requested review from a team as code owners March 31, 2026 14:02
@github-actions github-actions Bot added the needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. label Apr 30, 2026
@coqbot-app coqbot-app Bot removed the needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. label May 5, 2026
Comment thread vernac/search.ml Outdated

let name_of_reference ref = Id.to_string (Nametab.basename_of_global ref)

let string_contains_upto ?(limit=2) ~pattern s =

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add an option to set (optionally) the maximum distance allowed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed

@SkySkimmer SkySkimmer added needs: progress Work in progress: awaiting action from the author. kind: feature New user-facing feature request or implementation. request: full CI Use this label when you want your next push to trigger a full CI. and removed needs: progress Work in progress: awaiting action from the author. labels May 5, 2026
@SkySkimmer SkySkimmer requested a review from a team as a code owner May 5, 2026 16:18
@SkySkimmer SkySkimmer added this to the 9.3+rc1 milestone May 5, 2026
@coqbot-app coqbot-app Bot removed request: full CI Use this label when you want your next push to trigger a full CI. needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. labels May 5, 2026
@SkySkimmer SkySkimmer added the request: full CI Use this label when you want your next push to trigger a full CI. label May 5, 2026
For experimentation I set to to require exact substring match when the
searched string has length <= 4, and allow edit distance <= 2
otherwise. These 2 numbers could be turned into user-settable options.

IDK if these are good defaults.

Also not sure if constant ints is the right way to work. eg with
longer input strings we may want to allow more typos so maybe `2`
should be `min 2 (2% of input string length)` or some such thing.

Probably needs user feedback to progress.

(also no idea how performant this is)
@coqbot-app coqbot-app Bot removed the request: full CI Use this label when you want your next push to trigger a full CI. label May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind: feature New user-facing feature request or implementation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants