Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/text/search: Backwards as an IndexOption not implemented #59049

Open
3 tasks
flowchartsman opened this issue Mar 15, 2023 · 1 comment
Open
3 tasks

x/text/search: Backwards as an IndexOption not implemented #59049

flowchartsman opened this issue Mar 15, 2023 · 1 comment
Labels
FeatureRequest help wanted NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@flowchartsman
Copy link

x/text/search has an explicit implementation todo panic if you attempt to search backwards in text. Presumably, this is to support RTL languages, but the utility isn't clear. It would be nice to implement it if it's useful, or at the very least document that it can't be used.

For context, my use case involves query-driven scanning of string fields in streams of structured data for keywords in various languages, so I can see this being useful when combined with an appropriate language tag, though in my case it ends up being just a boolean match, so start >= 0 is fine for now.

As a side note, the package comments include the following todos:

  • Maybe IndexAll methods (probably not necessary).
  • Some way to match patterns in a Reader (a bit tricky).
  • Some fold transformer that folds text to comparable text, based on the search options. This is a common technique, though very different from the collation-based design of this package. It has a somewhat different use case, so probably makes sense to support both. Should probably be in a different package, though, as it uses completely different kind of tables (based on norm, cases, width and range tables.)

I could see the last of these being useful to me in lieu of stemming or lemmatization, and the longstanding #16863 suggests that maybe x/text/search could use a little love. If @mpvl or anyone else would be willing to give me some guidance, I'd be willing to try and carve off some cycles to clear these out.

What version of Go are you using (go version)?

n/a

Does this issue reproduce with the latest release?

Yes, it is currently in the code here: https://github.com/golang/text/blob/master/search/search.go#L192-L193

What operating system and processor architecture are you using (go env)?

n/a

What did you do?

attempted to use Backwards as an IndexOption

What did you expect to see?

Not a panic.

What did you see instead?

panic: TODO: implement

@gopherbot gopherbot added this to the Unreleased milestone Mar 15, 2023
@cherrymui cherrymui changed the title x/text/search: panic on the use of Backwards as an IndexOption x/text/search: Backwards as an IndexOption not implemented Mar 15, 2023
@cherrymui cherrymui added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Mar 15, 2023
@nikola-jokic
Copy link
Contributor

Can I take a shot at this one? ☺️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FeatureRequest help wanted NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants