bddlmZddlmZGddZGddeZGddeZGd d eZGd d eZGd deZ y))List) DataErrorc heZdZdZdZdZdZdZdZdZ dZ d Z dd e d e e d edede f dZdZdZy )FieldNUMERICTEXTWEIGHTGEOTAGVECTORSORTABLENOINDEXASNnameargssortableno_indexas_namec |g}||_||_t|_||_|r)|jj t j|r)|jj t j|r|s tdyy)Nz-Non-Sortable non-Indexable fields are ignored) rrlist args_suffixrappendrr r ValueError)selfrrrrrs =/usr/lib/python3/dist-packages/redis/commands/search/field.py__init__zField.__init__s{ <D  6     # #ENN 3     # #EMM 2 HLM M%8c:|jj|yN)rr)rvalues r append_argzField.append_arg)s rc|jg}|jr||j|jgz }||jz }||jz }|Sr)rrrrr)rrs r redis_argszField.redis_args,sN { << TWWdll+ +D       r)NFFN)__name__ __module__ __qualname__rrr r r r r rrstrrboolrr!r#rrrrsG D F C C FHG B  NN3iN N  N  N. rrc 8eZdZdZdZdZ d dedededefd Z y) TextFieldzI TextField is used to define a text field in a schema definition NOSTEMPHONETICNrweightno_stemphonetic_matcherc 4tj||fdtjtj|gi||r tj ||j |r<|dvr7tj ||j tj ||yyy)Nr)zdm:enzdm:frzdm:ptzdm:es)rrrr r!r,r-)rrr.r/r0kwargss rrzTextField.__init__=s tTUU\\6(JUfU    T4;; /  05 !   T4== 1   T#3 4! r)g?FN) r$r%r&__doc__r,r-r'floatr(rr)rrr+r+5sIFH  $ 555 5  5rr+ceZdZdZdefdZy) NumericFieldzO NumericField is used to define a numeric field in a schema definition rc Ttj||fdtjgi|yNr)rrrrrr2s rrzNumericField.__init__Xs  tTBB6BrNr$r%r&r3r'rr)rrr6r6SsCSCrr6ceZdZdZdefdZy)GeoFieldzP GeoField is used to define a geo-indexing field in a schema definition rc Ttj||fdtjgi|yr8)rrr r9s rrzGeoField.__init__as  tT> >v>rNr:r)rrr<r<\s?S?rr<c0eZdZdZdZdZ d dededefdZy) TagFieldzx TagField is a tag-indexing field with simpler compression and tokenization. See http://redisearch.io/Tags/ SEPARATOR CASESENSITIVEr separatorcase_sensitivec tj|j|g}|r|j|jtj ||fd|i|yr8)rr r@rrAr)rrrBrCr2rs rrzTagField.__init__nsE 4>>95  KK** + tT777rN),F) r$r%r&r3r@rAr'r(rr)rrr?r?es7 I#MGL88$'8?C8rr?c$eZdZdZdededefdZy) VectorFieldz Allows vector similarity queries against the value in this attribute. See https://oss.redis.com/redisearch/Vectors/#vector_fields. r algorithm attributesc h|jdd}|jdd}|s|r td|jdvr tdg}|jD]\}} |j || gt j ||fdt j|t|g|i|y) a Create Vector Field. Notice that Vector cannot have sortable or no_index tag, although it's also a Field. ``name`` is the name of the field. ``algorithm`` can be "FLAT" or "HNSW". ``attributes`` each algorithm can have specific attributes. Some of them are mandatory and some of them are optional. See https://oss.redis.com/redisearch/master/Vectors/#specific_creation_attributes_per_algorithm for more information. rFrz5Cannot set 'sortable' or 'no_index' in Vector fields.)FLATHNSWzIRealtime vector indexing supporting 2 Indexing Methods:'FLAT' and 'HNSW'.rN) getrupperitemsextendrrr len) rrrHrIr2sortnoindexattr_likeyr s rrzVectorField.__init__~szz*e,**Z/ 7ST T ?? $4 4%  $**, )JC NNC< ( )  $ #llIs7|NgN RX rN)r$r%r&r3r'dictrr)rrrGrGxs! ! S! S! d! rrGN) typingrredisrrr+r6r<r?rGr)rrrYsT,,^55<C5C?u?8u8&' %' r