Reputation: 197
I need to allow text free search for values containing dashes, so like ABCD-12EF
.
I know that the standard
analyzer does not work well with -
because it splits the content in multiple tokens. I've created an index like the one below to try out keyword
and whitespace
analyzers but it seems like that the *
chars does not work anymore. I get results only if I search for the complete value without *
so ABCD-12EF
. If I search for ABCD-12EF
or ABCD-12*
or ABCD*
I dont'get any result.
Any idea why?
public class IndexTryOut
{
[Key, IsFilterable]
public string Id { get; set; }
[IsSearchable, IsFilterable]
[Analyzer("keyword")]
public string Data1 { get; set; }
[IsSearchable, IsFilterable]
[Analyzer("whitespace")]
public string Data2 { get; set; }
}
Upvotes: 0
Views: 345
Reputation: 258
You can define a custom analyzer that uses a “keyword” tokenizer with a “lowercase” token filter - see my answer to this question: How to index a field with alphanumeric characters AND a dash for wildcard search.
Upvotes: 1