ó
    ùÞ jø,  ã                   óÆ   • S SK JrJr  \" 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
 " S S5      r " S S5      rg)é    )ÚListÚUnionc                   ó4   • \ rS rSrS	S\S\SS4S jjrS rSrg)
ÚLimité   ÚoffsetÚcountÚreturnNc                 ó   • Xl         X l        g ©N)r   r	   )Úselfr   r	   s      Ú[/var/www/html/gaurav/venv/lib/python3.13/site-packages/redis/commands/search/aggregation.pyÚ__init__ÚLimit.__init__   s   € ØŒØ�
ó    c                 ó~   • U R                   (       a+  S[        U R                  5      [        U R                   5      /$ / $ )NÚLIMIT)r	   Ústrr   ©r   s    r   Ú
build_argsÚLimit.build_args   s,   € Ø�:�:ØœS §¡Ó-¬s°4·:±:«Ð?Ð?àˆIr   )r	   r   )r   r   ©Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Úintr   r   Ú__static_attributes__© r   r   r   r      s!   † ñ˜sð ¨sð ¸4õ õr   r   c                   ód   • \ rS rSrSrSrS\\   SS4S jrS\SS 4S jr	\
S\\   4S	 j5       rS
rg)ÚReduceré   zf
Base reducer object for all reducers.

See the `redisearch.reducers` module for the actual reducers.
NÚargsr
   c                 ó,   • Xl         S U l        S U l        g r   )Ú_argsÚ_fieldÚ_alias©r   r#   s     r   r   ÚReducer.__init__   s   € ØŒ
ØˆŒØˆ�r   Úaliasc                 óz   • U[         L a+  U R                  (       d  [        S5      eU R                  SS nXl        U $ )a³  
Set the alias for this reducer.

### Parameters

- **alias**: The value of the alias for this reducer. If this is the
    special value `aggregation.FIELDNAME` then this reducer will be
    aliased using the same name as the field upon which it operates.
    Note that using `FIELDNAME` is only possible on reducers which
    operate on a single field value.

This method returns the `Reducer` object making it suitable for
chaining.
z(Cannot use FIELDNAME alias with no fieldé   N)Ú	FIELDNAMEr&   Ú
ValueErrorr'   )r   r*   s     r   r*   ÚReducer.alias    s8   € ð ”IÒØ—;—;Ü Ð!KÓLÐLà—K‘K  �OˆEØŒØˆr   c                 ó   • U R                   $ r   )r%   r   s    r   r#   ÚReducer.args7   s   € à�z‰zÐr   )r'   r%   r&   )r   r   r   r   Ú__doc__ÚNAMEr   r   r   r*   Úpropertyr#   r   r   r   r   r!   r!      sW   † ñð €Dð˜d 3™ið ¨Dô ð
˜3ð  9ô ð. ð�d˜3‘ió ó ór   r!   c                   ó.   • \ rS rSrSrSrS\SS4S jrSrg)ÚSortDirectioné<   z8
This special class is used to indicate sort direction.
NÚfieldr
   c                 ó   • Xl         g r   ©r8   )r   r8   s     r   r   ÚSortDirection.__init__C   s   € Ø�
r   r:   )	r   r   r   r   r2   Ú	DIRSTRINGr   r   r   r   r   r   r6   r6   <   s!   † ñð €Ið˜cð  d÷ r   r6   c                   ó   • \ rS rSrSrSrSrg)ÚAscéG   zC
Indicate that the given field should be sorted in ascending order
ÚASCr   N©r   r   r   r   r2   r<   r   r   r   r   r>   r>   G   s   † ñð ƒIr   r>   c                   ó   • \ rS rSrSrSrSrg)ÚDescéO   zD
Indicate that the given field should be sorted in descending order
ÚDESCr   NrA   r   r   r   rC   rC   O   s   † ñð ƒIr   rC   c                   ó<  • \ rS rSrSrSS\SS4S jjrS\\   SS 4S jrS\\   S	\	\
\\
   4   SS 4S
 jrSS jrS\S\SS 4S jrS\\   SS 4S jrS\	\\\   4   SS 4S jrSS jrSS jrS\SS 4S jrSS jrS S\S\SS 4S jjrS\\   4S jrS\SS 4S jrSrg)!ÚAggregateRequestéW   z@
Aggregation request which can be passed to `Client.aggregate`.
Úqueryr
   Nc                 óœ   • Xl         / U l        / U l        SU l        SU l        SU l        SU l        / U l        SU l        SU l	        SU l
        g)a=  
Create an aggregation request. This request may then be passed to
`client.aggregate()`.

In order for the request to be usable, it must contain at least one
group.

- **query** Query string for filtering records.

All member methods (except `build_args()`)
return the object itself, making them useful for chaining.
Fr   NÚTFIDF)Ú_queryÚ_aggregateplanÚ_loadfieldsÚ_loadallÚ_maxÚ_with_schemaÚ	_verbatimÚ_cursorÚ_dialectÚ_add_scoresÚ_scorer)r   rI   s     r   r   ÚAggregateRequest.__init__\   sS   € ð ŒØ ˆÔØˆÔØˆŒØˆŒ	Ø!ˆÔØˆŒØˆŒØˆŒØ ˆÔØˆ�r   Úfieldsc                 ó\   • U(       a  U R                   R                  U5        U $ SU l        U $ )a  
Indicate the fields to be returned in the response. These fields are
returned in addition to any others implicitly specified.

### Parameters

- **fields**: If fields not specified, all the fields will be loaded.
Otherwise, fields should be given in the format of `@field`.
T)rN   ÚextendrO   )r   rX   s     r   ÚloadÚAggregateRequest.loadu   s0   € ö Ø×Ñ×#Ñ# FÔ+ð ˆð !ˆDŒMØˆr   Úreducersc           	      ó¸  • [        U[        5      (       a  U/OUn[        U[        5      (       a  U/OUnS[        [        U5      5      /UQnU Hl  nUSUR                  [        [        UR
                  5      5      /-  nUR                  UR
                  5        UR                  c  M[  USUR                  /-  nMn     U R                  R                  U5        U $ )a<  
Specify by which fields to group the aggregation.

### Parameters

- **fields**: Fields to group by. This can either be a single string,
    or a list of strings. both cases, the field should be specified as
    `@field`.
- **reducers**: One or more reducers. Reducers may be found in the
    `aggregation` module.
ÚGROUPBYÚREDUCEÚAS)	Ú
isinstancer   r!   Úlenr3   r#   rZ   r'   rM   )r   rX   r]   ÚretÚreducers        r   Úgroup_byÚAggregateRequest.group_by…   s»   € ô (¨´×4Ñ4�&‘¸&ˆÜ!+¨H´g×!>Ñ!>�H‘:ÀHˆàœ#œc &›kÓ*Ð4¨VÐ4ˆÛˆGØ�H˜gŸl™l¬C´°G·L±LÓ0AÓ,BÐCÑCˆCØ�J‰J�w—|‘|Ô$Ø�~‰~Ó)Ø˜˜gŸn™nÐ-Ñ-’ñ	  ð 	×Ñ×"Ñ" 3Ô'Øˆr   c                 óŠ   • UR                  5        H.  u  p#SU/nUb  USU/-  nU R                  R                  U5        M0     U $ )a!  
Specify one or more projection expressions to add to each result

### Parameters

- **kwexpr**: One or more key-value pairs for a projection. The key is
    the alias for the projection, and the value is the projection
    expression itself, for example `apply(square_root="sqrt(@foo)")`
ÚAPPLYra   )ÚitemsrM   rZ   )r   Úkwexprr*   Úexprrd   s        r   ÚapplyÚAggregateRequest.apply    sN   € ð "Ÿ<™<ž>‰KˆEØ˜D�/ˆCØÑ Ø˜˜e�}Ñ$�Ø×Ñ×&Ñ& sÖ+ñ	 *ð ˆr   r   Únumc                 ón   • [        X5      nU R                  R                  UR                  5       5        U $ )aX  
Sets the limit for the most recent group or query.

If no group has been defined yet (via `group_by()`) then this sets
the limit for the initial pool of results from the query. Otherwise,
this limits the number of items operated on from the previous group.

Setting a limit on the initial search results may be useful when
attempting to execute an aggregation on a sample of a large data set.

### Parameters

- **offset**: Result offset from which to begin paging
- **num**: Number of results to return


Example of sorting the initial results:

```
AggregateRequest("@sale_amount:[10000, inf]")            .limit(0, 10)            .group_by("@state", r.count())
```

Will only group by the states found in the first 10 results of the
query `@sale_amount:[10000, inf]`. On the other hand,

```
AggregateRequest("@sale_amount:[10000, inf]")            .limit(0, 1000)            .group_by("@state", r.count()            .limit(0, 10)
```

Will group all the results matching the query, but only return the
first 10 groups.

If you only wish to return a *top-N* style query, consider using
`sort_by()` instead.

)r   rM   rZ   r   )r   r   ro   Ú_limits       r   ÚlimitÚAggregateRequest.limit²   s1   € ôT �vÓ#ˆØ×Ñ×"Ñ" 6×#4Ñ#4Ó#6Ô7Øˆr   c                 ó˜  • [        U[        [        45      (       a  U/n/ nU H9  n[        U[        5      (       a  X4R                  UR                  /-  nM4  X4/-  nM;     S[        [        U5      5      /nUR                  U5        UR                  SS5      nUS:”  a  US[        U5      /-  nU R                  R                  U5        U $ )a¤  
Indicate how the results should be sorted. This can also be used for
*top-N* style queries

### Parameters

- **fields**: The fields by which to sort. This can be either a single
    field or a list of fields. If you wish to specify order, you can
    use the `Asc` or `Desc` wrapper classes.
- **max**: Maximum number of results to return. This can be
    used instead of `LIMIT` and is also faster.


Example of sorting by `foo` ascending and `bar` descending:

```
sort_by(Asc("@foo"), Desc("@bar"))
```

Return the top 10 customers:

```
AggregateRequest()            .group_by("@customer", r.sum("@paid").alias(FIELDNAME))            .sort_by(Desc("@paid"), max=10)
```
ÚSORTBYÚmaxr   ÚMAX)	rb   r   r6   r8   r<   rc   rZ   ÚgetrM   )r   rX   ÚkwargsÚfields_argsÚfrd   rv   s          r   Úsort_byÚAggregateRequest.sort_byà   s½   € ô8 �fœs¤MÐ2×3Ñ3Ø�XˆFàˆÛˆAÜ˜!œ]×+Ñ+Ø§¡¨¯©Ð5Ñ5’à˜sÑ"’ñ	 ð œœS Ó-Ó.Ð/ˆØ�
‰
�;ÔØ�j‰j˜ Ó"ˆØ�‹7Ø�Eœ3˜s›8Ð$Ñ$ˆCà×Ñ×"Ñ" 3Ô'Øˆr   Úexpressionsc                 ó‚   • [        U[        5      (       a  U/nU H   nU R                  R                  SU/5        M"     U $ )zÏ
Specify filter for post-query results using predicates relating to
values in the result set.

### Parameters

- **fields**: Fields to group by. This can either be a single string,
    or a list of strings.
ÚFILTER)rb   r   rM   rZ   )r   r~   Ú
expressions      r   ÚfilterÚAggregateRequest.filter  sB   € ô �k¤3×'Ñ'Ø&˜-ˆKã%ˆJØ×Ñ×&Ñ&¨°*Ð'=Ö>ñ &ð ˆr   c                 ó   • SU l         U $ )zd
If set, the `schema` property will contain a list of `[field, type]`
entries in the result object.
T)rQ   r   s    r   Úwith_schemaÚAggregateRequest.with_schema!  s   € ð
 !ˆÔØˆr   c                 ó   • SU l         U $ )z=
If set, includes the score as an ordinary field of the row.
T)rU   r   s    r   Ú
add_scoresÚAggregateRequest.add_scores)  s   € ð  ˆÔØˆr   Úscorerc                 ó   • Xl         U $ )z²
Use a different scoring function to evaluate document relevance.
Default is `TFIDF`.

:param scorer: The scoring function to use
               (e.g. `TFIDF.DOCNORM` or `BM25`)
)rV   )r   rŠ   s     r   rŠ   ÚAggregateRequest.scorer0  s   € ð ŒØˆr   c                 ó   • SU l         U $ )NT)rR   r   s    r   ÚverbatimÚAggregateRequest.verbatim;  s   € ØˆŒØˆr   r	   Úmax_idlec                 óz   • S/nU(       a  US[        U5      /-  nU(       a  US[        US-  5      /-  nX0l        U $ )NÚ
WITHCURSORÚCOUNTÚMAXIDLEiè  )r   rS   )r   r	   r�   r#   s       r   ÚcursorÚAggregateRequest.cursor?  sD   € Øˆ~ˆÞØ�Wœc %›jÐ)Ñ)ˆDÞØ�Y¤ H¨t¡OÓ 4Ð5Ñ5ˆDØŒØˆr   c                 óT  • U R                   /nU R                  (       a  UR                  S5        U R                  (       a  UR                  S5        U R                  (       a  UR                  SU R                  /5        U R                  (       a  UR                  S5        U R                  (       a  XR                  -  nU R                  (       a#  UR                  S5        UR                  S5        OjU R                  (       aY  UR                  S5        UR                  [        [        U R                  5      5      5        UR                  U R                  5        U R                  (       a  UR                  SU R                  /5        UR                  U R                  5        U$ )NÚ
WITHSCHEMAÚVERBATIMÚSCORERÚ	ADDSCORESÚLOADÚ*ÚDIALECT)rL   rQ   ÚappendrR   rV   rZ   rU   rS   rO   rN   r   rc   rT   rM   )r   rd   s     r   r   ÚAggregateRequest.build_argsH  s  € à�{‰{ˆmˆà××Ø�J‰J�|Ô$à�>�>Ø�J‰J�zÔ"à�<�<Ø�J‰J˜ $§,¡,Ð/Ô0à××Ø�J‰J�{Ô#à�<�<Ø—<‘<ÑˆCà�=�=Ø�J‰J�vÔØ�J‰J�s�Oà××Ø�J‰J�vÔØ�J‰J”sœ3˜t×/Ñ/Ó0Ó1Ô2Ø�J‰J�t×'Ñ'Ô(à�=�=Ø�J‰J˜	 4§=¡=Ð1Ô2à�
‰
�4×&Ñ&Ô'àˆ
r   Údialectc                 ó   • Xl         U $ )zk
Add a dialect field to the aggregate command.

- **dialect** - dialect version to execute the query under
)rT   )r   r¡   s     r   r¡   ÚAggregateRequest.dialectk  s   € ð  ŒØˆr   )rU   rM   rS   rT   rO   rN   rP   rL   rV   rR   rQ   )r�   )r
   rG   )r   g        )r   r   r   r   r2   r   r   r   r[   r   r!   rf   rm   r   rr   r|   r‚   r…   rˆ   rŠ   rŽ   Úfloatr•   r   r¡   r   r   r   r   rG   rG   W   s  † ññ˜cð ¨Dõ ð2˜D ™Ið Ð*<ô ð Ø˜3‘iðØ,1°'¸4À¹=Ð2HÑ,Iðà	ôô6ð$,˜Cð , cð ,Ð.@ô ,ð\-˜t C™yð -Ð7Iô -ð^ %¨¨T°#©Y¨Ñ"7ð Ð<Nô ô$ôð	˜Sð 	Ð%7ô 	ôñ˜Cð ¨uð Ð?Qõ ð!˜D ™Iô !ðF˜sð Ð'9÷ r   rG   c                   ó,   • \ rS rSrS\SS4S jrS rSrg)ÚCursoriu  Úcidr
   Nc                 ó,   • Xl         SU l        SU l        g )Nr   )r§   r�   r	   ©r   r§   s     r   r   ÚCursor.__init__v  s   € ØŒØˆŒØˆ�
r   c                 óÞ   • [        U R                  5      /nU R                  (       a  US[        U R                  5      /-  nU R                  (       a  US[        U R                  5      /-  nU$ )Nr”   r“   )r   r§   r�   r	   r(   s     r   r   ÚCursor.build_args{  sS   € Ü�D—H‘H“ˆˆØ�=�=Ø�Y¤ D§M¡MÓ 2Ð3Ñ3ˆDØ�:�:Ø�Wœc $§*¡*›oÐ.Ñ.ˆDØˆr   )r§   r	   r�   r   r   r   r   r¦   r¦   u  s   † ð˜Cð  Dô õ
r   r¦   c                   ó8   • \ rS rSrS\SS4S jrS\\44S jrSrg)ÚAggregateResulti„  r•   r
   Nc                 ó(   • Xl         X l        X0l        g r   )Úrowsr•   Úschema)r   r°   r•   r±   s       r   r   ÚAggregateResult.__init__…  s   € ØŒ	ØŒØ�r   c           	      óÔ   • U R                   (       a  U R                   R                  OSnSU R                  R                   S[	        U 5      S S[        U R                  5       SU S3	$ )NéÿÿÿÿÚ<z at 0xÚxz Rows=z	, Cursor=Ú>)r•   r§   Ú	__class__r   Úidrc   r°   r©   s     r   Ú__repr__ÚAggregateResult.__repr__Š  sZ   € Ø!%§§ˆd�k‰k�oŠo°"ˆà�—‘×'Ñ'Ð(¨¬r°$«x¸¨lð ;Ü˜Ÿ	™	“NÐ# 9¨S¨E°ð4ð	
r   )r•   r°   r±   )	r   r   r   r   r¦   r   r   rº   r   r   r   r   r®   r®   „  s%   † ð Vð ¸ô ð

˜3 ˜*÷ 
r   r®   N)Útypingr   r   Úobjectr-   r   r!   r6   r>   rC   rG   r¦   r®   r   r   r   Ú<module>r¾      sg   ðß á‹H€	÷	ñ 	÷'ñ '÷Tñ ôˆ-ô ôˆ=ô ÷[ñ [÷|ñ ÷
ò 
r   