o
    zqfe  ã                   @   s*   d dl mZ d dlmZ G dd„ dƒZdS )é   )Ú	to_string)ÚDocumentc                   @   s*   e Zd ZdZ	d
dd„Zdefdd„Zd	S )ÚResultz[
    Represents the result of a search query, and has an array of Document
    objects
    é    Fc                 C   s”  |d | _ || _g | _d}|r|d }|r|d }|r|d }|r#dnd}tdt|ƒ|ƒD ]š}t|| ƒ}	|r?t|||  ƒnd}
|rG|d n|}|rSt||d  ƒnd}i }|r†|||  dur†|r„tttt	t|||  ddd… ƒt	t|||  ddd… ƒƒƒƒni }z|d= W n	 t
y”   Y nw z|d |d< |d= W n	 t
y©   Y nw |r·t|	f||
dœ|¤Žn	t|	fd	|
i|¤Ž}| j |¡ q-d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Údoc© r"   ú[/root/parts/websockify/install/lib/python3.10/site-packages/redis/commands/search/result.pyÚ__init__   s\   

øþÿÿ	ö
ÿ
ÿÿýÛzResult.__init__Úreturnc                 C   s   d| j › d| j› dS )NzResult{z total, docs: Ú})r   r   )r   r"   r"   r#   Ú__repr__H   s   zResult.__repr__N)r   FF)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r$   Ústrr'   r"   r"   r"   r#   r      s
    
ÿ=r   N)Ú_utilr   Údocumentr   r   r"   r"   r"   r#   Ú<module>   s    