Skip to content

Commit 3e26c01

Browse files
committed
feat: Add double metaphone phonetic matcher
1 parent 9156402 commit 3e26c01

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

redisearch/client.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class Field(object):
2121
SORTABLE = 'SORTABLE'
2222
NOINDEX = 'NOINDEX'
2323
SEPARATOR = 'SEPARATOR'
24+
PHONETIC = 'PHONETIC'
2425

2526
def __init__(self, name, *args):
2627
self.name = name
@@ -37,14 +38,17 @@ class TextField(Field):
3738
NOSTEM = 'NOSTEM'
3839

3940
def __init__(self, name, weight=1.0, sortable=False, no_stem=False,
40-
no_index=False):
41+
no_index=False, phonetic_matcher=None):
4142
args = [Field.TEXT, Field.WEIGHT, weight]
4243
if no_stem:
4344
args.append(self.NOSTEM)
4445
if sortable:
4546
args.append(Field.SORTABLE)
4647
if no_index:
4748
args.append(self.NOINDEX)
49+
if phonetic_matcher and phonetic_matcher in ['dm:en', 'dm:fr', 'dm:pt', 'dm:es']:
50+
args.append(self.PHONETIC)
51+
args.append(phonetic_matcher)
4852

4953
if no_index and not sortable:
5054
raise ValueError('Non-Sortable non-Indexable fields are ignored')

0 commit comments

Comments
 (0)