Abhinand
Abhinand

Reputation: 11

Solr character substitution

I want to map

 "A" => "4"
 "A" => "8"

for searching using solr

But i didn't want

"4" => "A"
"8" => "A"
"4" => "8"

What to do for this.Please help me

Upvotes: 0

Views: 72

Answers (1)

MatsLindh
MatsLindh

Reputation: 52882

The first case - where a single characters maps into multiple characters - will be an issue unless each character is a separate token already. If you have separate tokens, a synonym filter allows you to only expand synonyms in one direction.

Two comma-separated lists of words with the symbol "=>" between them. If the token matches any word on the left, then the list on the right is substituted. The original token will not be included unless it is also in the list on the right.

If you only want to replace a character with a single other character, you can use a MappingCharFilter or a PatternReplaceFilter.

Upvotes: 1

Related Questions