Hello,
I have a problem (I’m sure there is a solution).
I would like to be able to search for a specific ID.
How do I have to analyze the field so that I can search for the ID?
Example:
ID number 1:
2021-006
I want to perform the following search:
2021-*
2021*
2021-006*
ID number 2:
TEST #: 2021-006011-26
I would like to perform the following search:
test*
test #*
test #:*
test #: 2021*
test #: 2021-*
TEST #: 2021-006011-26*
It should work similarly for an ID field. You will just have to declare new analyzers where you remove unnecessary analysis components, such as the tokenizer (replace it with a KeywordTokenizer) and the SnowballPorterFilterFactory (remove it, you don’t need it for IDs).
Alternatively, you can use a @KeywordField with a simple “lowercasing” normalizer (similar to the one named lowercase in this example), and rely on a wildcard predicate. It’s less flexible, but should work for simple use cases.
Hello, as always thanks for the quick reply.
I would like to be able to analyze the fields with “-” , “#” , “:” to be able to analyze and also search with or without these special characters.
My problem is, unfortunately I don’t know which analyzer/tokenizer to use at this point.
It should be indexed like this. EXAMPLE: TEST #: 2021-006011-26
=> “TEST”, “#”, “TEST #:”, “2021” “2021-” and so on.