TextField is used to define a text field in a schema definition
| 77 | |
| 78 | |
| 79 | class TextField(Field): |
| 80 | """ |
| 81 | TextField is used to define a text field in a schema definition |
| 82 | """ |
| 83 | |
| 84 | NOSTEM = "NOSTEM" |
| 85 | PHONETIC = "PHONETIC" |
| 86 | |
| 87 | def __init__( |
| 88 | self, |
| 89 | name: str, |
| 90 | weight: float = 1.0, |
| 91 | no_stem: bool = False, |
| 92 | phonetic_matcher: str = None, |
| 93 | withsuffixtrie: bool = False, |
| 94 | **kwargs, |
| 95 | ): |
| 96 | Field.__init__(self, name, args=[Field.TEXT, Field.WEIGHT, weight], **kwargs) |
| 97 | |
| 98 | if no_stem: |
| 99 | Field.append_arg(self, self.NOSTEM) |
| 100 | if phonetic_matcher and phonetic_matcher in [ |
| 101 | "dm:en", |
| 102 | "dm:fr", |
| 103 | "dm:pt", |
| 104 | "dm:es", |
| 105 | ]: |
| 106 | Field.append_arg(self, self.PHONETIC) |
| 107 | Field.append_arg(self, phonetic_matcher) |
| 108 | if withsuffixtrie: |
| 109 | Field.append_arg(self, "WITHSUFFIXTRIE") |
| 110 | |
| 111 | |
| 112 | class NumericField(Field): |
no outgoing calls