
    ph/                         S SK Jr  S SKJr   " S S5      r " S S\5      r " S S\5      r " S	 S
\5      r " S S\5      r " S S\5      r	 " S S\5      r
g)    )List)	DataErrorc                       \ rS rSrSrSrSrSrSrSr	Sr
S	rS
rSrSrSrSr      SS\S\\   S\S\S\S\S\4S jjrS rS rSrg)Field   z-
A class representing a field in a document.
NUMERICTEXTWEIGHTGEOTAGVECTORSORTABLENOINDEXASGEOSHAPEINDEXMISSING
INDEXEMPTYNnameargssortableno_indexindex_missingindex_emptyas_namec                    Uc  / nXl         X l        [        5       U l        Xpl        U(       a)  U R                  R                  [        R                  5        U(       a)  U R                  R                  [        R                  5        U(       a)  U R                  R                  [        R                  5        U(       a)  U R                  R                  [        R                  5        U(       a  U(       d  [        S5      egg)a  
Create a new field object.

Args:
    name: The name of the field.
    args:
    sortable: If `True`, the field will be sortable.
    no_index: If `True`, the field will not be indexed.
    index_missing: If `True`, it will be possible to search for documents that
                   have this field missing.
    index_empty: If `True`, it will be possible to search for documents that
                 have this field empty.
    as_name: If provided, this alias will be used for the field.
Nz-Non-Sortable non-Indexable fields are ignored)r   r   listargs_suffixr   appendr   r   INDEX_MISSINGINDEX_EMPTYr   
ValueError)selfr   r   r   r   r   r   r   s           U/home/james-whalen/.local/lib/python3.13/site-packages/redis/commands/search/field.py__init__Field.__init__   s    0 <D		6##EMM2##E$7$78##E$5$56##ENN3HLMM %8    c                 :    U R                   R                  U5        g N)r   r   )r"   values     r#   
append_argField.append_argC   s    		r&   c                     U R                   /nU R                  (       a  XR                  U R                  /-  nXR                  -  nXR                  -  nU$ r(   )r   r   r   r   r   )r"   r   s     r#   
redis_argsField.redis_argsF   sH    		{<<WWdll++D		   r&   )r   r   r   r   )NFFFFN)__name__
__module____qualname____firstlineno____doc__r   r	   r
   r   r   r   r   r   r   r   r   r    strr   boolr$   r*   r-   __static_attributes__ r&   r#   r   r      s     GDF
C
CFHG	BH"MK
 #!)N)N 3i)N 	)N
 )N )N )N )NV r&   r   c                   J    \ rS rSrSrSrSr    SS\S\S\	S	\S
\	4
S jjr
Srg)	TextFieldO   zA
TextField is used to define a text field in a schema definition
NOSTEMPHONETICNr   weightno_stemphonetic_matcherwithsuffixtriec                 ~   [         R                  " X4S[         R                  [         R                  U/0UD6  U(       a  [         R	                  X R
                  5        U(       a:  US;   a4  [         R	                  X R                  5        [         R	                  X5        U(       a  [         R	                  U S5        g g )Nr   )zdm:enzdm:frzdm:ptzdm:esWITHSUFFIXTRIE)r   r$   r	   r
   r*   r;   r<   )r"   r   r=   r>   r?   r@   kwargss          r#   r$   TextField.__init__W   s     	tUU\\6(JUfUT;;/ 0 5
 !
 T==1T4T#34 r&   r7   )g      ?FNF)r/   r0   r1   r2   r3   r;   r<   r4   floatr5   r$   r6   r7   r&   r#   r9   r9   O   s[     FH
  $$55 5 	5
 5 5 5r&   r9   c                   &    \ rS rSrSrS\4S jrSrg)NumericFieldp   zG
NumericField is used to define a numeric field in a schema definition
r   c                 T    [         R                  " X4S[         R                  /0UD6  g Nr   )r   r$   r   r"   r   rC   s      r#   r$   NumericField.__init__u   s    tBB6Br&   r7   Nr/   r0   r1   r2   r3   r4   r$   r6   r7   r&   r#   rG   rG   p   s    CS Cr&   rG   c                   2    \ rS rSrSrSrSrS	S\4S jjrSr	g)
GeoShapeFieldy   zC
GeoShapeField is used to enable within/contain indexing/searching
	SPHERICALFLATNr   c                     [         R                  /nU(       a  UR                  U5        [         R                  " X4SU0UD6  g rJ   )r   r   r   r$   )r"   r   coord_systemrC   r   s        r#   r$   GeoShapeField.__init__   s3    KK%t777r&   r7   r(   )
r/   r0   r1   r2   r3   rQ   rR   r4   r$   r6   r7   r&   r#   rO   rO   y   s$     ID8S 8 8r&   rO   c                   &    \ rS rSrSrS\4S jrSrg)GeoField   zH
GeoField is used to define a geo-indexing field in a schema definition
r   c                 T    [         R                  " X4S[         R                  /0UD6  g rJ   )r   r$   r   rK   s      r#   r$   GeoField.__init__   s    t>>v>r&   r7   NrM   r7   r&   r#   rW   rW      s    ?S ?r&   rW   c            	       D    \ rS rSrSrSrSr   SS\S\S\S\4S	 jjr	S
r
g)TagField   zl
TagField is a tag-indexing field with simpler compression and tokenization.
See http://redisearch.io/Tags/
	SEPARATORCASESENSITIVEr   	separatorcase_sensitiver@   c                     [         R                  U R                  U/nU(       a  UR                  U R                  5        U(       a  UR                  S5        [         R
                  " X4SU0UD6  g )NrB   r   )r   r   r^   r   r_   r$   )r"   r   r`   ra   r@   rC   r   s          r#   r$   TagField.__init__   sS     		4>>95KK**+KK()t777r&   r7   N),FF)r/   r0   r1   r2   r3   r^   r_   r4   r5   r$   r6   r7   r&   r#   r\   r\      sN    
 I#M
 $$88 8 	8
 8 8r&   r\   c                   .    \ rS rSrSrS\S\S\4S jrSrg)	VectorField   z
Allows vector similarity queries against the value in this attribute.
See https://oss.redis.com/redisearch/Vectors/#vector_fields.
r   	algorithm
attributesc           	         UR                  SS5      nUR                  SS5      nU(       d  U(       a  [        S5      eUR                  5       S;  a  [        S5      e/ nUR                  5        H  u  pUR	                  X/5        M     [
        R                  " X4S[
        R                  U[        U5      /UQ0UD6  g)	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", "HNSW", or "SVS-VAMANA".

``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.
r   Fr   z5Cannot set 'sortable' or 'no_index' in Vector fields.)rR   HNSWz
SVS-VAMANAzXRealtime vector indexing supporting 3 Indexing Methods:'FLAT', 'HNSW', and 'SVS-VAMANA'.r   N)	getr   upperitemsextendr   r$   r   len)
r"   r   rh   ri   rC   sortnoindexattr_likeyr)   s
             r#   r$   VectorField.__init__   s     zz*e,**Z/7STT??$BB4 
 $**,JCNNC<( - 		
#llIs7|NgN	
RX	
r&   r7   N)	r/   r0   r1   r2   r3   r4   dictr$   r6   r7   r&   r#   rf   rf      s!    
!
S !
S !
d !
r&   rf   N)typingr   redisr   r   r9   rG   rO   rW   r\   rf   r7   r&   r#   <module>ry      sc     F FR5 5BC5 C8E 8?u ?8u 84'
% '
r&   