o
    rPfe                     @   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|rt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 |rt|	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"   ]/var/www/html/humari/django-venv/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    