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

Separate search between frontend and backend #39

Closed
wants to merge 25 commits into from

Conversation

faassen
Copy link
Collaborator

@faassen faassen commented Jan 21, 2025

This is a large PR unfortunately. Here's what happened:

  • the existing FMIndex and RLFMIndex structs become backend structs, implementing a backend trait.

  • define new FMIndex and RLFMIndex frontend structs that don't know anything about backend traits. This unfortunately requires quite a bit of code duplication. The alternative is to try to write a general frontend code on top of the backend trait. But this would require the backend trait to be public, meaning we have to do the whole seal thing again. I chose to make the backend completely hidden.

  • Also define new traits for the frontend in frontend.rs. Those traits are not required to use FMIndex or RLFMIndex unless you want to use them in a generic way.

  • Something I'm not super happy with: defined a new frontend traits SearchIndexWithLocate and SearchWithLocate. This allows us to hide the marker traits HasLocation entirely, but it makes it difficult to see in the documentation when the locate functionality is available. I still hope we can find a better way to support this behavior.

  • Made those tests that could work against the frontend API work against that, keeping those that test internals in the backend code.

  • right now len and is_empty and size aren't yet part of the frontend search index, but we could do that, what do you think?

So in summary we have some wiring code that feels redundant in the frontend implementation but the benefit is that we can completely hide how it's all implemented.

The one thing exposed that I think we could consider not exposing as well is the suffix array. Right now we use this information to let the locate method exist in type-driven way, but I'd prefer it if we could hide that a suffix array is involved entirely. I'm not sure what that looks like yet. (and we'd have to do the same for the doc array)

We can't use this yet as we need to create traits too, so we'll do RLFMI next.
@faassen
Copy link
Collaborator Author

faassen commented Jan 21, 2025

I should have looked better at github as I missed your own PR that was already there! I am okay with going further with that one, but I think some naming ideas could be taken from this one.

@faassen faassen marked this pull request as draft January 21, 2025 16:15
@faassen
Copy link
Collaborator Author

faassen commented Jan 22, 2025

I've withdrawn this PR in favor of yours.

@faassen faassen closed this Jan 22, 2025
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.

1 participant