-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce a SearchIndex trait and SearchIndexWithLocate trait.
These are intended to be the generic public API. FMIndexBackend is now not intended to be used in the public API at all, though it's still exposed to it because the SearchIndex trait depends on it. The SearchIndex and SearchIndexWithLocate traits are object-safe, i.e. they're compatible with dyn. The idea is that we can then use a builder that produces a Box<dyn SearchIndex>, as this is required to support a dynamic builder that picks the backend based on the builder parameters. I haven't implemented this new builder yet, but this is a prerequisite for that. Unfortunately to make SearchIndex object-safe I can't use the generic K argument to `search` anymore. This is used to easily take an AsRef and is especially useful when you pass in a string. I've instead come up with a solution using dyn, which has some performance overhead but I suspect it's really tiny so we should be okay. That solution is not the exact equivalent of AsRef; you have to manually `&` the string to make a reference to make it work. I think that's acceptable enough.
- Loading branch information
Showing
8 changed files
with
133 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ where | |
Search { | ||
index, | ||
s: 0, | ||
e: index.len(), | ||
e: index.len::<seal::Local>(), | ||
pattern: vec![], | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters