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

FMIndex breaks if text is too short #23

Open
faassen opened this issue Jan 9, 2025 · 1 comment
Open

FMIndex breaks if text is too short #23

faassen opened this issue Jan 9, 2025 · 1 comment

Comments

@faassen
Copy link
Collaborator

faassen commented Jan 9, 2025

    #[test]
    fn test_one_character() {
        let text = "c".to_string().into_bytes();
        let fm_index = FMIndex::new(
            text,
            RangeConverter::new(b'a', b'z'),
            SuffixOrderSampler::new().level(2),
        );
        assert_eq!(fm_index.search_backward("c").count(), 1);
    }

fails with:

sampling level L must satisfy 2^L < text_len (L = 2, text_len = 2)

I can make this work when I set level(0). I don't know what level does; I doubt it's wise to always set level to 0 for any text length, right? Would it possible to create some kind of heuristic and create an automatic sampler that creates a good sampling level based off text length?

@faassen
Copy link
Collaborator Author

faassen commented Jan 9, 2025

I still can't make it work if the text just contains a "\0" even with level set to 0.

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

No branches or pull requests

1 participant