Skip to content
New issue

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

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

Already on GitHub? # to your account

Allow custom definitions of in-word characters #2

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

AlbertWeichselbraun
Copy link

This pull request allows specifying custom in-word characters for words by extending isPartialMatch in Trie.java, which improves the libraries flexibility in defining word boundaries.

Example:

// create a searcher that allows numbers and hyphens in words.
StringSearcher searcher = StringSearcher.builder().addSearchString("ER-Models")
                .addSearchString("Database").addSearchString("C2")
                .setIsInWordCharacter(ch -> Character.isAlphabetic(ch) || Character.isDigit(ch) || ch == '-').build();

Both the currently used onlyWholeWordsWhiteSpaceSeparated and onlyWholeWords flags can be expressed with a corresponding inWordCharacterexpression.
=> StringSearcherConfig.java has been adapted to continue supporting both flags as well.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant