
    )Jfe                     8    d dl mZ d dlmZ  G d d          ZdS )   )	to_string)Documentc                   (    e Zd ZdZ	 ddZdefdZdS )	Resultz[
    Represents the result of a search query, and has an array of Document
    objects
        Fc                 V   |d         | _         || _        g | _        d}|r|dz   }|r|dz   }|r|dz   }|rdnd}t          dt	          |          |          D ]P}t          ||                   }	|rt          |||z                      nd}
|r|dz   n|}|rt          ||dz                      nd}i }|r|||z            x|rtt          t          t          t          t
          |||z            ddd                   t          t
          |||z            ddd                                                 ni }	 |d= n# t          $ r Y nw xY w	 |d         |d<   |d= n# t          $ r Y nw xY w|rt          |	f||
d|nt          |	fd	|
i|}| j                            |           RdS )
zy
        - **snippets**: An optional dictionary of the form
        {field: snippet_size} for snippet formatting
        r   r      Nid$json)scorepayloadr   )totaldurationdocsrangelenr   floatdictzipmapKeyErrorr   append)selfres
hascontentr   has_payloadwith_scoresstepoffsetir
   r   fields_offsetr   fieldsdocs                  _/home/alex/cs2snipeproduction/venv/lib/python3.11/site-packages/redis/commands/search/result.py__init__zResult.__init__   sV    V
 	 	!8D 	!8D 	!8D!(qq#c((D)) %	" %	"A3q6""B4?IiAJ000TG*5AFQJJ6M)4>E#a!e*%%%$EF c!m"34@ "	D #Is1}3D/Eccc/J K K #Is1}3D/Eadd/K L L      4LL   !'v3KK   
 =D5'DDVDDDb<<'<V<< 
 IS!!!!K%	" %	"s$   8D<<
E	E	E
E)(E)returnc                 (    d| j          d| j         dS )NzResult{z total, docs: })r   r   )r   s    r%   __repr__zResult.__repr__H   s    A$*AADIAAAA    N)r   FF)__name__
__module____qualname____doc__r&   strr*    r+   r%   r   r      s\          KP;" ;" ;" ;"zB# B B B B B Br+   r   N)_utilr   documentr   r   r1   r+   r%   <module>r4      so               DB DB DB DB DB DB DB DB DB DBr+   