Ë
    kQêjä ã                  ó,  — d dl mZ d dlZd dlmZmZ d dlmZ d dlm	Z	 d dl
mZ d dlmZmZmZmZmZmZmZmZmZmZmZmZmZ d dlZd dlZd dlZd dlm Z! d dl"Z"d dl#m$Z$ d d	l%m&Z& d d
l'm(Z( ddl)m*Z* ddl+m,Z, ddl-m.Z/ ddl0m1Z1 ddl2m3Z3 ddl4m5Z5 ddl6m7Z7 ddl8m9Z9m:Z:m;Z; ddl<m=Z=m>Z>m?Z? ddl)m@Z@ ddlAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJmKZKmLZLmMZM ddlNmOZOmPZP er`d dlQZQd dlRZRd dlSZTddlUmVZW ddlUmXZY ddlUmZZZ ddlUm[Z\ ddlUm]Z^ ddlUm_Z` ddlambZb ddl"mcZc dd ldmeZemfZf eQjÎ                  d!k\  rd d"lmhZh nd d"l#mhZh  ed#d$¬%«      Zied&   ZjekelejÚ                  ejÜ                  ejÞ                  fZpd'Zqe G d(„ d)e«      «       Zrdvd*„Zs	 	 	 	 	 	 dwd+„Ztdxd,„Zudyd-„Zvdzd.„Zwd{d0„Zxd|d1„Zy	 	 	 	 	 	 d}d2„Zzd~d3„Z{dd4„Z|	 d€dd5œ	 	 	 	 	 	 	 	 	 d�d6„Z}d‚d7„Z~	 	 	 	 	 	 	 	 dƒd8„Zd„d9„Z€	 	 	 	 	 	 d…d:„Z�	 	 	 	 	 	 	 	 	 	 	 	 	 	 d†d;„Z‚	 	 	 	 	 	 	 	 	 	 d‡d<„Zƒ	 	 	 	 	 	 	 	 	 	 	 	 	 	 dˆd=„Z„	 	 	 	 d‰d>„Z… G d?„ d@e"�j                  «      Z‡ G dA„ dBeˆe«      Z‰ G dC„ dDeˆe«      ZŠ G dE„ dFeˆe«      Z‹ G dG„ dHeˆe«      ZŒe"�j                  �j                   G dI„ dJe«      «       Z�e"�j                  �j                   G dK„ dLe�«      «       Z�e"�j                  �j                   G dM„ dNe�«      «       Z‘e"�j                  �j                   G dO„ dPe�«      «       Z’e"�j                  �j                   G dQ„ dRe�«      «       Z“e"�j                  �j                   G dS„ dTe�«      «       Z” G dU„ dVe"�j                  «      Z• G dW„ d/e"�j                  «      Z[ G dX„ dYe«      Z– G dZ„ d[e–«      Z— G d\„ d]e–«      Z˜ G d^„ d_e–«      Z™ G d`„ dae–«      Zš G db„ dce›«      Zœ G dd„ deeœ«      Z� G df„ dge�«      Zž G dh„ die�«      ZŸ G dj„ dk«      Z  G dl„ dme�e «      Z¡ G dn„ doe�e «      Z¢ G dp„ dqeœ«      Z£ G dr„ dse›«      Z¤ G dt„ due¤«      Z¥y)Šé    )ÚannotationsN)ÚABCÚabstractmethod)ÚThreadPoolExecutor)Ú	timedelta)ÚEnum)ÚTYPE_CHECKINGÚAnyÚDictÚIterableÚListÚLiteralÚOptionalÚProtocolÚTupleÚTypeÚTypeVarÚUnionÚruntime_checkable)Ú	Annotated©Úfts_query_to_json)ÚLOOPé   )Ú__version__)ÚAsyncRecordBatchReader)Úpandas)ÚExpr)ÚReranker)ÚRRFReranker)Úcheck_reranker_result)Úblob_column_pathsÚis_blob_like_fieldÚschema_has_blob_field)Ú_validate_query_vectorÚflatten_columnsÚget_uri_scheme)Ú_wal_hybrid)ÚBLOB_MODE_TO_HANDLINGÚFetchBlobsAsyncÚFetchBlobsSyncÚblob_auto_row_id_for_scanÚblob_v2_projection_sourcesÚfinalize_blob_query_tableÚreject_unfetchable_blob_columnsÚreject_unmatched_blob_outputsÚ"replace_v2_blob_columns_with_bytesÚ'replace_v2_blob_columns_with_bytes_syncÚstrip_auto_row_idsÚvalidate_blob_mode)ÚBlobModeÚQueryProjection)ÚFTSQuery)ÚHybridQuery)ÚPyQueryRequest)ÚQuery)Ú	TakeQuery)ÚVectorQuery)ÚVEC)Ú
LanceModel)Ú
AsyncTableÚTable)é   é   )ÚSelfÚTr>   )Úbound)Ú	aggregateÚ
per_workerÚfullé
   c                  ó@   — e Zd ZU ded<   ded<   d	d
d„Zd„ Zdd„Zd„ Zy)Ú_LanceScannerzpa.Schema | NoneÚprojected_schemaÚschemac                 ó   — y ©N© )ÚselfÚ	blob_modeÚkwargss      úR/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/lancedb/query.pyÚ	to_pandasz_LanceScanner.to_pandasa   ó   � ó    c                 ó   — y rO   rP   ©rQ   s    rT   Ú
to_pyarrowz_LanceScanner.to_pyarrowc   rV   rW   c                 ó   — y rO   rP   rY   s    rT   Úto_tablez_LanceScanner.to_tablee   rV   rW   c                 ó   — y rO   rP   rY   s    rT   Ú	to_readerz_LanceScanner.to_readerg   rV   rW   N).)rR   zBlobMode | NoneÚreturnúpd.DataFrame)r_   úpa.Table)Ú__name__Ú
__module__Ú__qualname__Ú__annotations__rU   rZ   r\   r^   rP   rW   rT   rK   rK   \   s   … à&Ó&ØÓäXâã'ãrW   rK   c                ót   — | j                  d«      } | d   j                  «       | dd  z   } t        d| › d�«      S )Nú.r   r   zSBlob columns require Lance native scanner conversion for this query's to_pandas(). z². For supported blob v2 queries, pass blob_mode='bytes' or blob_mode='descriptions'. Otherwise, install pylance for scanner conversion or remove blob columns from the projection.)ÚrstripÚupperÚRuntimeError)Úreasons    rT   Ú_unsupported_blob_pandas_errorrl   j   sN   € Ø�]‰]˜3Ó€FØ�A‰Y�_‰_Ó ¨¨ Ñ+€FÜð	Ø�xð  Uð	Uóð rW   c                óB   — | j                   j                  «       xr d|vS )NÚ
QueryTable)Ú_innerÚ
_is_native)Úasync_tableÚpushdown_operationss     rT   Ú_supports_local_blob_fetchrs   u   s$   € ð
 ×Ñ×(Ñ(Ó*ÒV¨|ÐCVÐ/VÐVrW   c                 ó   — t        d«      S )Nzöblob_mode='bytes' cannot safely materialize blob columns without a stable table snapshot. Remote tables and namespace QueryTable pushdown run the query on a server, so the blob fetch could read another table version. Use blob_mode='descriptions'.©ÚNotImplementedErrorrP   rW   rT   Ú"_blob_bytes_without_snapshot_errorrw   }   s   € Üð	1óð rW   c                óR   — t        | d| «      }|j                  j                  «        S )NÚ_table)Úgetattrro   rp   )Útablerq   s     rT   Ú_is_remote_query_tabler|   †   s(   € Ü˜% ¨5Ó1€KØ×!Ñ!×,Ñ,Ó.Ð.Ð.rW   c                óº   — t        | dd«      }|€y	  |«       }|j                  duxs% |j                  duxs t	        |j
                  «      S # t        $ r Y yw xY w)z5Whether the query sets options that to_arrow ignores.Úto_query_objectNF)rz   rv   Ú	fragmentsÚfragment_idsÚboolÚwith_row_address)Úbuilderr~   Úquerys      rT   Ú_query_needs_lance_scannerr…   ‹   st   € ä˜gÐ'8¸$Ó?€OØÐØðÙÓ!ˆð 	�‰˜tÐ#ò 	(Ø×Ñ TÐ)ò	(ä�×&Ñ&Ó'ðøô ò Ùðús   ’A Á	AÁAr:   c                óš   — | j                   d u xr< | j                  d u xr, | j                  d u xr | j                   xr | j                   S rO   )ÚvectorÚfull_text_queryÚtake_offsetsÚ
postfilterÚorder_by)r„   s    rT   Ú_query_is_plain_scanrŒ   ›   s]   € à�‰˜Ðò 	Ø×!Ñ! TÐ)ò	à×Ñ $Ð&ò	ð × Ñ Ð ò	ð —‘ÐðrW   c                óL   — | €y t        | t        «      r| j                  «       S | S rO   ©Ú
isinstancer   Úto_sql)Úfilters    rT   Ú_filter_to_sqlr’   ¥   s%   € Ø€~ØÜ�&œ$ÔØ�}‰}‹ÐØ€MrW   c                ó¾   — | €|S t        | t        «      }t        |t        «      }|r|r| |z  S |r| j                  «       n| }|r|j                  «       n|}d|› d|› d�S )aK  Combine a new filter with an existing one using a logical AND.

    Calling ``where`` more than once composes the filters with AND instead of
    replacing the previous filter. Two :class:`~lancedb.expr.Expr` filters are
    combined as an expression; otherwise both filters are lowered to SQL strings
    and combined as SQL.
    ú(z) AND (ú)rŽ   )ÚexistingÚnewÚexisting_is_exprÚnew_is_exprÚexisting_sqlÚnew_sqls         rT   Ú_combine_whererœ   ­   sk   € ð ÐØˆ
Ü! (¬DÓ1ÐÜ˜S¤$Ó'€KÙ™KØ˜#‰~ÐÙ(8�8—?‘?Ô$¸h€LÙ)ˆc�j‰jŒl¨s€GØˆ|ˆn˜G G 9¨AÐ.Ð.rW   c           
     ó„  — | si S t        | t        «      rdt        d„ | D «       «      rd| iS t        d„ | D «       «      r8d| D ��ci c](  \  }}|t        |t        «      r|j	                  «       n|“Œ* c}}iS d| iS i }| j                  «       D ]*  \  }}t        |t        «      r|j	                  «       }|||<   Œ, d|iS c c}}w )Nc              3  ó<   K  — | ]  }t        |t        «      –— Œ y ­wrO   ©r�   Ústr©Ú.0Úcolumns     rT   ú	<genexpr>z0_projection_to_scanner_kwargs.<locals>.<genexpr>Ç   s   è ø€ Ò=¨6Œz˜&¤#×&Ñ=ùó   ‚Úcolumnsc              3  ó\   K  — | ]$  }t        |t        «      xr t        |«      d k(  –— Œ& y­w)é   N)r�   ÚtupleÚlenr¡   s     rT   r¤   z0_projection_to_scanner_kwargs.<locals>.<genexpr>É   s(   è ø€ ÒTÀ&Œz˜&¤%Ó(Ò=¬S°«[¸AÑ-=Ó=ÑTùs   ‚*,)r�   ÚlistÚallr   r�   Úitems)r¦   ÚnameÚexprÚ
projections       rT   Ú_projection_to_scanner_kwargsr±   Â   sÔ   € áØˆ	Ü�'œ4Ô ÜÑ=°WÔ=Ô=Ø˜wÐ'Ð'ÜÑTÈGÔTÔTàà&-÷á"˜˜dð ¬:°d¼DÔ+A˜$Ÿ+™+œ-ÀtÑKóðð ð ˜7Ð#Ð#à€JØ—m‘m“oò  ‰
ˆˆdÜ�dœDÔ!Ø—;‘;“=ˆDØˆ
�4Òð ð �zÐ"Ð"ùós   Á-B<c                óJ   — | j                   r| j                   S | j                  S rO   )Úselect_source_columnsÚselect)Úreqs    rT   Ú_query_request_projectionr¶   Û   s!   € à
× Ò Ø×(Ñ(Ð(Ø�:‰:ÐrW   ©Úwith_row_idc          
     óX  — t        | |«      }i t        | j                  «      ¥t        | j                  «      | j
                  | j                  |�|n| j                  | j                  | j                  t        |   |dœ¥}|j                  «       D ��ci c]  \  }}|€Œ	||“Œ c}}S c c}}w )N)r‘   ÚlimitÚoffsetr¸   r‚   Úfast_searchÚblob_handlingr   )Ú_scanner_fragments_for_queryr±   r¦   r’   r‘   rº   r»   r¸   r‚   r¼   r)   r­   )r„   rR   Údatasetr¸   r   rS   ÚkeyÚvalues           rT   Ú_scanner_kwargs_for_queryrÂ   â   s�   € ô -¨U°GÓ<€Ið
Ü
'¨¯©Ó
6ð
ä  §¡Ó.Ø—‘Ø—,‘,Ø&1Ð&=‘{À5×CTÑCTØ!×2Ñ2Ø×(Ñ(Ü.¨yÑ9Øò
€Fð *0¯©«×M™:˜3 ¸5Ñ;LˆC�‰JÓMÐMùÓMs   Â
B&ÂB&c                óâ  — | j                   �| j                  �t        d«      ‚| j                   �| j                   S | j                  €y |€t        d«      ‚t        | j                  «      }|j	                  «       D �cg c]  }|j
                  |v r|‘Œ }}|D �ch c]  }|j
                  ’Œ }}||z
  }|r/dj                  d„ t        |«      D «       «      }t        d|› �«      ‚|S c c}w c c}w )Nz-fragments and fragment_ids cannot both be setz$fragment_ids require a Lance datasetz, c              3  ó2   K  — | ]  }t        |«      –— Œ y ­wrO   )r    )r¢   Úfragment_ids     rT   r¤   z/_scanner_fragments_for_query.<locals>.<genexpr>  s   è ø€ ÒT°[¤ K× 0ÑTùs   ‚z#fragment_ids not found in dataset: )r   r€   Ú
ValueErrorÚsetÚget_fragmentsrÅ   ÚjoinÚsorted)r„   r¿   Ú	requestedÚfragmentr   ÚfoundÚmissingÚmissing_idss           rT   r¾   r¾   ø   s   € Ø‡�Ð" u×'9Ñ'9Ð'EÜÐHÓIÐIØ‡�Ð"Ø�‰ÐØ×ÑÐ!ØØ€ÜÐ?Ó@Ð@ä�E×&Ñ&Ó'€Ið  ×-Ñ-Ó/öàØ×Ñ 9Ñ,ò 	ð€Ið ð
 3<Ö< hˆX×!Ó!Ð<€EÐ<Ø˜%Ñ€GÙØ—i‘iÑTÄFÈ7ÃOÔTÓTˆÜÐ>¸{¸mÐLÓMÐMØÐùòùò
 =s   Á=C'ÂC,c                ó  — |dk7  st        |«      rt        | «      dk(  r| S |D ]\  }t        |«      r|j                  | j                  vrŒ'| |j                     j
                  d   }|€ŒFt        |d«      rŒSt        d«      ‚ | S )NÚlazyr   Úreadallz0the Lance scanner did not return lazy blob files)r$   rª   r#   r®   r¦   ÚilocÚhasattrrl   )ÚdfrM   rR   ÚfieldrÁ   s        rT   Ú_ensure_lazy_blob_framer×     sŠ   € ð �FÒÔ"7¸Ô"?Ä3ÀrÃ7ÈaÂ<Øˆ	àò ˆÜ! %Ô(¨E¯J©J¸b¿j¹jÑ,HØØ�5—:‘:‘×#Ñ# AÑ&ˆØÑ¤W¨U°IÕ%>Ü0ØBóð ðð €IrW   c                óÒ   — t        | d«      r | j                  «       }|j                  «       S t        | d«      r| j                  «       S | j	                  «       }|j                  «       S )NrZ   r\   )rÔ   rZ   Úread_allr\   r^   )ÚscannerÚreaders     rT   Ú_scanner_to_tablerÜ   !  s[   € Üˆw˜Ô%Ø×#Ñ#Ó%ˆØ�‰Ó Ð Üˆw˜
Ô#Ø×ÑÓ!Ð!Ø×ÑÓ €FØ�?‰?ÓÐrW   c                óÜ  — t        | dd «      }|€t        | dd «      }|€t        | dd «      }t        |«      r |«       }t        | d«      r&	  | j                  d	d|i|¤Ž}|�t        |||«      S |S t        | «      }|dk(  r t        |j                  «      rt        d«      ‚ |j                  d	i |¤ŽS # t        $ r0}t        |«      }d|vrd|vr‚  | j                  d	i |¤Ž}Y d }~Œ‡d }~ww xY w)
NrL   rM   Údataset_schemarU   rR   zunexpected keywordrÑ   z+the Lance scanner does not expose to_pandasrP   )rz   ÚcallablerÔ   rU   Ú	TypeErrorr    r×   rÜ   r$   rM   rl   )rÚ   rR   rS   rM   rÕ   ÚerrÚmessageÚtbls           rT   Ú_scanner_to_pandasrä   +  s  € ô �WÐ0°$Ó7€FØ€~Ü˜ (¨DÓ1ˆØ€~Ü˜Ð"2°DÓ9ˆÜ�ÔÙ“ˆÜˆw˜Ô$ð	-Ø"�×"Ñ"ÑA¨YÐA¸&ÑAˆBð ÐÜ*¨2¨v°yÓAÐAØˆ	ä
˜GÓ
$€CØ�FÒÔ4°S·Z±ZÔ@Ü,Ø9ó
ð 	
ð ˆ3�=‰=Ñ"˜6Ñ"Ð"øô ò 	-Ü˜#“hˆGØ 'Ñ)Ð.BÈ'Ñ.QØØ"�×"Ñ"Ñ, VÑ,�Bûð		-ús   ÁB2 Â2	C+Â;&C&Ã&C+c               ó´  — |rZt        | «      }t        |||«      }|r d|j                  v r|j                  dg«      }|�t	        ||«      } |j
                  di |¤ŽS |�It	        t        | «      |«      }|r d|j                  v r|j                  dg«      } |j
                  di |¤ŽS t        | |fi |¤Ž}|r!d|j                  v r|j                  dg¬«      S |S ©NÚ_rowid)r¦   rP   )	rÜ   r2   Úcolumn_namesÚdrop_columnsr&   rU   rä   r¦   Údrop©	rÚ   rR   Úblob_sourcesÚfetch_blobsÚstrip_auto_row_idÚflattenrS   rã   rÕ   s	            rT   Ú_finish_plain_scan_pandasrð   I  sì   € ñ Ü Ó(ˆÜ5°c¸<ÈÓUˆÙ ¨S×-=Ñ-=Ñ!=Ø×"Ñ" H :Ó.ˆCØÐÜ! # wÓ/ˆCØˆs�}‰}Ñ&˜vÑ&Ð&ØÐÜÔ/°Ó8¸'ÓBˆÙ ¨S×-=Ñ-=Ñ!=Ø×"Ñ" H :Ó.ˆCØˆs�}‰}Ñ&˜vÑ&Ð&Ü	˜G YÑ	9°&Ñ	9€BÙ˜X¨¯©Ñ3Ø�w‰w ˜zˆwÓ*Ð*Ø€IrW   c               óÜ   — t        | j                  «      s t        | |«      j                  di |¤ŽS |dk(  r(t	        | |«      }  t        | |«      j                  di |¤ŽS t        d|›d�«      ‚)NÚdescriptionszremote to_pandas(blob_mode=zf) cannot safely materialize blob columns without a stable table snapshot; use blob_mode='descriptions'rP   )r"   rM   r&   rU   r3   rv   )rã   rR   Ú
blob_pathsrï   rS   s        rT   Ú_finish_remote_pandasrô   f  s|   € ô ˜SŸZ™ZÔ(Ø6Œ˜s GÓ,×6Ñ6Ñ@¸Ñ@Ð@Ø�NÒ"Ü   jÓ1ˆØ6Œ˜s GÓ,×6Ñ6Ñ@¸Ñ@Ð@Ü
Ø
% i ]ð 3'ð 	'óð rW   c             ‹  óÐ  K  — |rbt        | «      }t        |||«      ƒ d {  –—† }|r d|j                  v r|j                  dg«      }|�t	        ||«      } |j
                  di |¤ŽS |�It	        t        | «      |«      }|r d|j                  v r|j                  dg«      } |j
                  di |¤ŽS t        | |fi |¤Ž}|r!d|j                  v r|j                  dg¬«      S |S 7 ŒÃ­wræ   )	rÜ   r1   rè   ré   r&   rU   rä   r¦   rê   rë   s	            rT   Ú_finish_plain_scan_pandas_asyncrö   |  sù   è ø€ ñ Ü Ó(ˆÜ6°s¸LÈ+ÓV×VˆÙ ¨S×-=Ñ-=Ñ!=Ø×"Ñ" H :Ó.ˆCØÐÜ! # wÓ/ˆCØˆs�}‰}Ñ&˜vÑ&Ð&ØÐÜÔ/°Ó8¸'ÓBˆÙ ¨S×-=Ñ-=Ñ!=Ø×"Ñ" H :Ó.ˆCØˆs�}‰}Ñ&˜vÑ&Ð&Ü	˜G YÑ	9°&Ñ	9€BÙ˜X¨¯©Ñ3Ø�w‰w ˜zˆwÓ*Ð*Ø€Ið Wús   ‚C& C$¡CC&c                ót  — t        | t        «      rt        | «      dk(  rt        d«      ‚| d   }nt        | t        «      rt        d«      ‚| }t        |t
        j                  «      r| S t        |t        «      r.t        |«      dk(  rt        d«      ‚t        |d   t        «      r| S t        |t        «      r| S y )Nr   z%Vector query must be a non-empty listzBVector query must be a list of floats or a list of lists of floats)r�   r«   rª   rÆ   ÚfloatÚpaÚArray)ÚvalÚsamples     rT   Úensure_vector_queryrý   š  s«   € ô �#”tÔÜˆs‹8�qŠ=ÜÐDÓEÐEØ�Q‘‰ä�cœ5Ô!ÜØTóð ð ˆÜ�&œ"Ÿ(™(Ô#àˆ
Ü�&œ$ÔÜˆv‹;˜!ÒÜÐDÓEÐEÜ�f˜Q‘i¤Ô'àˆJÜ�&œ%Ô àˆ
ð !rW   c                  ó4   — e Zd ZU ded<   dZded<   dZded<   y)	ÚColumnOrderingr    Úcolumn_nameTr�   Ú	ascendingFÚnulls_firstN)rb   rc   rd   re   r  r  rP   rW   rT   rÿ   rÿ   µ  s   … ØÓØ€IˆtÓØ€K�ÔrW   rÿ   c                  ó    — e Zd ZdZdZdZdZdZy)ÚFullTextQueryTypeÚmatchÚmatch_phraseÚboostÚmulti_matchÚbooleanN)rb   rc   rd   ÚMATCHÚMATCH_PHRASEÚBOOSTÚMULTI_MATCHÚBOOLEANrP   rW   rT   r  r  »  s   „ Ø€EØ!€LØ€EØ€KØ�GrW   r  c                  ó   — e Zd ZdZdZy)ÚFullTextOperatorÚANDÚORN)rb   rc   rd   r  r  rP   rW   rT   r  r  Ã  s   „ Ø
€CØ	�BrW   r  c                  ó   — e Zd ZdZdZdZy)ÚDocumentGranularityz2The unit treated as one full-text-search document.ÚrowÚlist_elementN)rb   rc   rd   Ú__doc__ÚROWÚLIST_ELEMENTrP   rW   rT   r  r  È  s   „ Ù<à
€CØ!�LrW   r  c                  ó   — e Zd ZdZdZdZy)ÚOccurÚSHOULDÚMUSTÚMUST_NOTN)rb   rc   rd   r  r  r  rP   rW   rT   r  r  Ï  s   „ Ø€FØ€DØ�HrW   r  c                  ó6   — e Zd Zedd„«       Zdd„Zdd„Zdd„Zy)	ÚFullTextQueryc                 ó   — y)z‚
        Get the query type of the query.

        Returns
        -------
        str
            The type of the query.
        NrP   rY   s    rT   Ú
query_typezFullTextQuery.query_type×  s   € ð 	rW   c                ó   — t        | «      S )aÌ  
        Convert the query to a JSON string.

        Returns
        -------
        str
            A JSON string representation of the query.

        Examples
        --------
        >>> from lancedb.query import MatchQuery
        >>> query = MatchQuery("puppy", "text", fuzziness=2)
        >>> query.to_json()
        '{"match":{"column":"text","terms":"puppy","boost":1.0,"fuzziness":2,"max_expansions":50,"operator":"Or","prefix_length":0}}'
        r   rY   s    rT   Úto_jsonzFullTextQuery.to_jsonã  s   € ô  ! Ó&Ð&rW   c                ó\   — t        t        j                  | ft        j                  |fg«      S )a)  
        Combine two queries with a logical AND operation.

        Parameters
        ----------
        other : FullTextQuery
            The other query to combine with.

        Returns
        -------
        FullTextQuery
            A new query that combines both queries with AND.
        )ÚBooleanQueryr  r  ©rQ   Úothers     rT   Ú__and__zFullTextQuery.__and__õ  s&   € ô œeŸj™j¨$Ð/´%·*±*¸eÐ1DÐEÓFÐFrW   c                ó\   — t        t        j                  | ft        j                  |fg«      S )a'  
        Combine two queries with a logical OR operation.

        Parameters
        ----------
        other : FullTextQuery
            The other query to combine with.

        Returns
        -------
        FullTextQuery
            A new query that combines both queries with OR.
        )r&  r  r  r'  s     rT   Ú__or__zFullTextQuery.__or__  s&   € ô œeŸl™l¨DÐ1´E·L±LÀ%Ð3HÐIÓJÐJrW   N©r_   r  ©r_   r    )r(  ú'FullTextQuery'r_   r.  )rb   rc   rd   r   r"  r$  r)  r+  rP   rW   rT   r   r   Õ  s%   „ àò	ó ð	ó'ó$Gô KrW   r   c                  ór  — e Zd ZU dZded<   dZded<    ej                  dd¬	«      Zd
ed<    ej                  dd¬	«      Z	ded<    ej                  dd¬	«      Z
ded<    ej                  ej                  d¬	«      Zded<    ej                  dd¬	«      Zded<    ej                  dd¬	«      Zded<   dd„Zy)Ú
MatchQuerya'  
    Match query for full-text search.

    Parameters
    ----------
    query : str
        The query string to match against.
    column : str, optional
        The column to match against. None leaves column selection to query planning.
    boost : float, default 1.0
        The boost factor for the query.
        The score of each matching document is multiplied by this value.
    fuzziness : int or None, default 0
        The maximum edit distance for each term in the match query.
        Defaults to 0 (exact match).
        If None, fuzziness is applied automatically by the rules:
            - 0 for terms with length <= 2
            - 1 for terms with length <= 5
            - 2 for terms with length > 5
    max_expansions : int, optional
        The maximum number of terms to consider for fuzzy matching.
        Defaults to 50.
    operator : FullTextOperator, default OR
        The operator to use for combining the query results.
        Can be either `AND` or `OR`.
        If `AND`, all terms in the query must match.
        If `OR`, at least one term in the query must match.
    prefix_length : int, optional
        The number of beginning characters being unchanged for fuzzy matching.
        This is useful to achieve prefix matching.
    document_granularity : DocumentGranularity, optional
        Explicitly select row or deepest-list-element documents. If omitted,
        the indexed granularity is inferred. When both granularities are indexed
        for the field, this must be specified. With no index, row granularity is used.
    r    r„   NúOptional[str]r£   g      ð?T©Úkw_onlyrø   r  r   úOptional[int]Ú	fuzzinessé2   ÚintÚmax_expansionsr  ÚoperatorÚprefix_lengthúOptional[DocumentGranularity]Údocument_granularityc                ó"   — t         j                  S rO   )r  r
  rY   s    rT   r"  zMatchQuery.query_typeG  ó   € Ü ×&Ñ&Ð&rW   r,  )rb   rc   rd   r  re   r£   ÚpydanticÚFieldr  r5  r8  r  r  r9  r:  r<  r"  rP   rW   rT   r0  r0    s·   … ñ"ðH ƒJØ €FˆMÓ Ø!�8—>‘> #¨tÔ4€Eˆ5Ó4Ø-˜xŸ~™~¨a¸Ô>€Iˆ}Ó>Ø(˜(Ÿ.™.¨°TÔ:€N�CÓ:Ø!/ §¡Ð0@×0CÑ0CÈTÔ!R€HÐÓRØ'˜Ÿ™¨°4Ô8€M�3Ó8Ø:H¸(¿.¹.Ø�dô;ÐÐ7ó ô'rW   r0  c                  ó–   — e Zd ZU dZded<   dZded<    ej                  dd¬	«      Zd
ed<    ej                  dd¬	«      Z	ded<   dd„Z
y)ÚPhraseQuerya‹  
    Phrase query for full-text search.

    Parameters
    ----------
    query : str
        The query string to match against.
    column : str, optional
        The column to match against. None leaves column selection to query planning.
    slop : int, default 0
        The maximum number of intervening positions permitted in the phrase.
    document_granularity : DocumentGranularity, optional
        Explicitly select row or deepest-list-element documents. If omitted,
        the indexed granularity is inferred. When both granularities are indexed
        for the field, this must be specified. With no index, row granularity is used.
    r    r„   Nr1  r£   r   Tr2  r7  Úslopr;  r<  c                ó"   — t         j                  S rO   )r  r  rY   s    rT   r"  zPhraseQuery.query_typee  s   € Ü ×-Ñ-Ð-rW   r,  )rb   rc   rd   r  re   r£   r?  r@  rC  r<  r"  rP   rW   rT   rB  rB  K  sR   … ñð" ƒJØ €FˆMÓ Ø�—‘˜q¨$Ô/€Dˆ#Ó/Ø:H¸(¿.¹.Ø�dô;ÐÐ7ó ô.rW   rB  c                  ó`   — e Zd ZU dZded<   ded<    ej                  dd¬«      Zded	<   dd
„Zy)Ú
BoostQuerya  
    Boost query for full-text search.

    Parameters
    ----------
    positive : dict
        The positive query object.
    negative : dict
        The negative query object.
    negative_boost : float, default 0.5
        The boost factor for the negative query.
    r   ÚpositiveÚnegativeg      à?Tr2  rø   Únegative_boostc                ó"   — t         j                  S rO   )r  r  rY   s    rT   r"  zBoostQuery.query_type|  r>  rW   Nr,  )	rb   rc   rd   r  re   r?  r@  rI  r"  rP   rW   rT   rF  rF  i  s1   … ñð ÓØÓØ*˜HŸN™N¨3¸Ô=€N�EÓ=ô'rW   rF  c                  ó¦   — e Zd ZU dZded<   ded<    ej                  dd¬«      Zd	ed
<    ej                  ej                  d¬«      Z
ded<   dd„Zy)ÚMultiMatchQuerya  
    Multi-match query for full-text search.

    Parameters
    ----------
    query : str | list[Query]
        If a string, the query string to match against.
    columns : list[str]
        The list of columns to match against.
    boosts : list[float], optional
        The list of boost factors for each column. If not provided,
        all columns will have the same boost factor.
    operator : FullTextOperator, default OR
        The operator to use for combining the query results.
        Can be either `AND` or `OR`.
        It would be applied to all columns individually.
        For example, if the operator is `AND`,
        then the query "hello world" is equal to
        `match("hello AND world", column1) OR match("hello AND world", column2)`.
    r    r„   z	list[str]r¦   NTr2  zOptional[list[float]]Úboostsr  r9  c                ó"   — t         j                  S rO   )r  r  rY   s    rT   r"  zMultiMatchQuery.query_typeœ  s   € Ü ×,Ñ,Ð,rW   r,  )rb   rc   rd   r  re   r?  r@  rM  r  r  r9  r"  rP   rW   rT   rL  rL  €  sP   … ñð* ƒJØÓØ$2 H§N¡N°4ÀÔ$F€FÐ!ÓFØ!/ §¡Ð0@×0CÑ0CÈTÔ!R€HÐÓRô-rW   rL  c                  ó$   — e Zd ZU dZded<   dd„Zy)r&  a)  
    Boolean query for full-text search.

    Parameters
    ----------
    queries : list[tuple(Occur, FullTextQuery)]
        The list of queries with their occurrence requirements.
        Each tuple contains an Occur value (MUST, SHOULD, or MUST_NOT)
        and a FullTextQuery to apply.
    z!list[tuple[Occur, FullTextQuery]]Úqueriesc                ó"   — t         j                  S rO   )r  r  rY   s    rT   r"  zBooleanQuery.query_type¯  s   € Ü ×(Ñ(Ð(rW   Nr,  )rb   rc   rd   r  re   r"  rP   rW   rT   r&  r&     s   … ñ	ð /Ó.ô)rW   r&  c                  ó*   — e Zd ZU dZdZded<   ded<   y)ÚFullTextSearchQueryaM  A LanceDB Full Text Search Query

    Attributes
    ----------
    columns: List[str]
        The columns to search

        If None, then the table should select the column automatically.
    query: str | FullTextQuery
        If a string, it is treated as a MatchQuery.
        If a FullTextQuery object, it is used directly.
    NzOptional[List[str]]r¦   zUnion[str, FullTextQuery]r„   )rb   rc   rd   r  r¦   re   rP   rW   rT   rS  rS  ³  s   … ñð $(€GÐ Ó'Ø$Ô$rW   rS  c                  ó¶  — e Zd ZU dZdZded<   dZded<   dZded<   dZd	ed
<   dZ	ded<   dZ
ded<   dZded<   dZded<   dZded<   dZded<   dZded<   dZded<   dZded<   dZded<   dZded<   dZd	ed<   dZd	ed<   dZded<   dZded<   dZded <   dZded!<   dZd	ed"<   dZd	ed#<   dZded$<   dZd	ed%<   dZd&ed'<   ed+d(„«       Z  e!jD                  d)¬*«      Z#y),r:   a†  A LanceDB Query

    Queries are constructed by the `Table.search` method.  This class is a
    python representation of the query.  Normally you will not need to interact
    with this class directly.  You can build up a query and execute it using
    collection methods such as `to_batches()`, `to_arrow()`, `to_pandas()`,
    etc.

    However, you can use the `to_query()` method to get the underlying query object.
    This can be useful for serializing a query or using it in a different context.

    Attributes
    ----------
    filter : Optional[str]
        sql filter to refine the query with
    limit : Optional[int]
        The limit on the number of results to return.  If this is a vector or FTS query,
        then this is required.  If this is a plain SQL query, then this is optional.
    offset: Optional[int]
        The offset to start fetching results from

        This is ignored for vector / FTS search (will be None).
    columns : Optional[Union[List[str], Dict[str, str]]]
        which columns to return in the results

        This can be a list of column names or a dictionary.  If it is a dictionary,
        then the keys are the column names and the values are sql expressions to
        use to calculate the result.

        If this is None then all columns are returned.  This can be expensive.
    with_row_id : Optional[bool]
        if True then include the row id in the results
    vector : Optional[Union[List[float], List[List[float]], pa.Array, List[pa.Array]]]
        the vector to search for, if this a vector search or hybrid search.  It will
        be None for full text search and plain SQL filtering.
    vector_column : Optional[str]
        the name of the vector column to use for vector search

        If this is None then a default vector column will be used.
    distance_type : Optional[str]
        the distance type to use for vector search

        This can be l2 (default), cosine and dot.  See
        [metric definitions](https://lancedb.com/docs/search/vector-search/) for
        more details.

        If this is not a vector search this will be None.
    postfilter : bool
        if True then apply the filter after vector / FTS search.  This is ignored for
        plain SQL filtering.
    nprobes : Optional[int]
        The legacy number of IVF partitions to search. Lance sets both probe
        bounds to this value. If this is None then Lance's default probe settings
        will be used.

        - A higher number makes search more accurate but also slower.

        - See discussion in
          [Querying an ANN Index](https://lancedb.com/docs/indexing/)
          for tuning advice.

        Will be None if this is not a vector search.
    refine_factor : Optional[int]
        Refine the results by reading extra elements and re-ranking them in memory.

        - A higher number makes search more accurate but also slower.

        - See discussion in
          [Querying an ANN Index](https://lancedb.com/docs/indexing/)
          for tuning advice.

        Will be None if this is not a vector search.
    lower_bound : Optional[float]
        The lower bound for distance search

        Only results with a distance greater than or equal to this value
        will be returned.

        This will only be set on vector search.
    upper_bound : Optional[float]
        The upper bound for distance search

        Only results with a distance less than or equal to this value
        will be returned.

        This will only be set on vector search.
    ef : Optional[int]
        The size of the nearest neighbor list maintained during HNSW search

        This will only be set on vector search.
    full_text_query : Optional[Union[str, dict]]
        The full text search query

        This can be a string or a dictionary.  A dictionary will be used to search
        multiple columns.  The keys are the column names and the values are the
        search queries.

        This will only be set on FTS or hybrid queries.
    fast_search: Optional[bool]
        Skip a flat search of unindexed data. This will improve
        search performance but search results will not include unindexed data.

        The default is False
    Nr1  Úvector_columnziAnnotated[Optional[Union[List[float], List[List[float]], pa.Array, List[pa.Array]]], ensure_vector_query]r‡   úOptional[Union[str, Expr]]r‘   úOptional[bool]rŠ   zOptional[FullTextSearchQuery]rˆ   r4  rº   Údistance_typeÚnprobesr6   r¦   Úminimum_nprobesÚmaximum_nprobesúOptional[float]Úsearch_effortÚlower_boundÚupper_boundÚrefine_factorr¸   r‚   úOptional[Any]r   zOptional[List[int]]r€   r»   r‰   r¼   Úuse_rteÚefÚbypass_vector_indexúOptional[List[ColumnOrdering]]r‹   c                óÊ  —  | «       }|j                   |_         |j                  |_        |j                  |_        |j                  |_        |j                  |_        |j                  |_        |j                  xs d |_        |j                  |_	        |j                  |_
        |j                  |_        |j                  |_        |j                  |_        |j                   |_        |j"                  |_        |j$                  |_        |j&                  |_        |j(                  |_        |j*                  |_        |j,                  |_        |j.                  |_        |j0                  |_        |j2                  |_        |j4                  �(|j4                  D �cg c]  }t7        di |¤Ž‘Œ c}|_        |j                  �t9        d |j                  ¬«      |_        |S c c}w )N)r¦   r„   rP   )rº   r»   r‰   r‘   Úfull_text_searchrˆ   r´   r¦   r¼   r¸   rb  r£   rU  Úquery_vectorr‡   rX  rY  rZ  r[  r]  r^  r_  rc  r`  rd  rŠ   r‹   rÿ   rS  )Úclsrµ   r„   Úos       rT   Ú
from_innerzQuery.from_innerŠ  s|  € á“ˆØ—i‘iˆŒØ—z‘zˆŒØ ×-Ñ-ˆÔØ—z‘zˆŒØ #× 4Ñ 4ˆÔØŸ
™
ˆŒàŸO™OÒ3¨tˆÔØŸO™OˆÔð Ÿ™ˆŒØ!Ÿj™jˆÔØ×'Ñ'ˆŒØ!×/Ñ/ˆÔØŸ™ˆŒØ #× 3Ñ 3ˆÔØ #× 3Ñ 3ˆÔØ!×/Ñ/ˆÔØŸO™OˆÔØŸO™OˆÔØ—6‘6ˆŒØ!×/Ñ/ˆÔØ$'×$;Ñ$;ˆÔ!ØŸ>™>ˆÔØ�<‰<Ð#Ø;>¿<¹<ÖH°aœnÑ1¨qÓ1ÒHˆEŒNØ×ÑÐ+Ü$7ØØ×*Ñ*ô%ˆEÔ!ð ˆùò Is   ÆG T)Úarbitrary_types_allowed)rµ   r9   r_   rC   )$rb   rc   rd   r  rU  re   r‡   r‘   rŠ   rˆ   rº   rX  rY  r¦   rZ  r[  r]  r^  r_  r`  r¸   r‚   r   r€   r»   r‰   r¼   rb  rc  rd  r‹   Úclassmethodrk  r?  Ú
ConfigDictÚmodel_configrP   rW   rT   r:   r:   Å  ss  … ñgðT $(€M�=Ó'ð 	ð ð ó ð *.€FÐ&Ó-ð "&€J�Ó%ð 6:€OÐ2Ó9ð  €Eˆ=Óð $(€M�=Ó'ð
 "€Gˆ]Ó!ð  $€Gˆ_Ó#ð
 &*€O�]Ó)ð &*€O�]Ó)ð &*€M�?Ó)ð $(€K�Ó'ð $(€K�Ó'ð $(€M�=Ó'ð #'€K�Ó&ð (,Ð�nÓ+ð  $€Iˆ}Ó#Ø(,€LÐ%Ó,ð !€FˆMÓ ð )-€LÐ%Ó,ð #'€K�Ó&ð
 #€Gˆ^Ó"ð €BˆÓð +/Ð˜Ó.à/3€HÐ,Ó3àò"ó ð"ðL '�8×&Ñ&¸tÔD�LrW   c                  ó¢  — e Zd ZdZe	 	 	 d1	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d2d„«       Zed„ «       Zed„ «       Zd3d„Z e	j                  dded	¬
«      d4d„«       Z	 d5dddœ	 	 	 	 	 	 	 d6d„Zedddœ	 	 	 	 	 d7d„«       Ze	 d5dddœ	 	 	 	 	 	 	 d8d„«       Zdddœ	 	 	 	 	 d9d„Z	 	 	 	 	 	 d7d„Zddœ	 	 	 	 	 d:d„Zddœd;d„Zd<d„Zd=d„Zd>d„Zd?d@d„ZdAd„ZdBd„ZdBd„ZdBd„ZdCd„ZdDd „ZdEd!„Z	 	 	 	 	 	 	 	 dFd"„Z 	 	 	 	 	 	 	 	 dFd#„Z!	 	 	 	 	 	 	 	 dGd$„Z"d?dHd%„Z#dId&„Z$dJd'„Z%dKd(„Z&dLdMd)„Z'dNd*„Z(	 dO	 	 	 dPd+„Z)dQd,„Z*dRd-„Z+edSd.„«       Z,	 d5	 	 	 	 	 dTd/„Z-edCd0„«       Z.y)UÚLanceQueryBuilderz€An abstract query builder. Subclasses are defined for vector search,
    full text search, hybrid, and plain SQL filtering.
    Nc                ó^  — |dk7  rt        |«       |�ddl}|j                  dt        d¬«       |dk(  rt	        ||||¬«      S |€t        |«      S t        |t        «      r|nd}	| j                  ||||«      \  }}|dk(  rt	        ||||¬«      S t        |t        t        f«      rt        |||||¬	«      S t        |t        t        f«      r&t        j                  |t        j                  ¬
«      }n¯t        |t        j                   «      r |j#                  t        j                  «      }nut        |t$        j&                  t$        j(                  f«      r4t        j                  |j+                  «       t        j                  ¬
«      }nt-        dt/        |«      › �«      ‚t1        ||||	|«      S )aÆ  
        Create a query builder based on the given query and query type.

        Parameters
        ----------
        table: Table
            The table to query.
        query: Optional[Union[np.ndarray, str, "PIL.Image.Image", Tuple]]
            The query to use. If None, an empty query builder is returned
            which performs simple SQL filtering.
        query_type: str
            The type of query to perform. One of "vector", "fts", "hybrid", or "auto".
            If "auto", the query type is inferred based on the query.
        vector_column_name: str
            The name of the vector column to use for vector search.
        ordering_field_name: Optional[str]
            .. deprecated:: 0.27.0
                Use ``order_by()`` method instead.
        fts_columns: Optional[Union[str, List[str]]]
            The columns to search in for full text search.
        fast_search: bool
            Skip flat search of unindexed data.
        ÚftsNr   zBordering_field_name is deprecated, use .order_by() method instead.r¨   )Ú
stacklevelÚhybrid©Úfts_columns)Úordering_field_namerw  r¼   ©ÚdtypezUnsupported query type: )r%   ÚwarningsÚwarnÚDeprecationWarningÚLanceHybridQueryBuilderÚLanceEmptyQueryBuilderr�   r    Ú_resolve_queryr   ÚLanceFtsQueryBuilderr«   r©   ÚnpÚarrayÚfloat32ÚndarrayÚastyperù   rú   ÚChunkedArrayÚ	to_pylistrà   ÚtypeÚLanceVectorQueryBuilder)
ri  r{   r„   r"  Úvector_column_namerx  rw  r¼   r{  Ú	str_querys
             rT   ÚcreatezLanceQueryBuilder.create¹  s’  € ðD ˜ÒÜ" 5Ô)àÐ*Ûà�M‰MØTÜ"Øð ô ð ˜Ò!ä*Ø�uÐ0¸kôð ð ˆ=Ü)¨%Ó0Ð0ô (¨¬sÔ3‘E¸ˆ	ð  ×.Ñ.Ø�5˜*Ð&8ó
Ñˆˆzð ˜Ò!Ü*Ø�uÐ0¸kôð ô �eœc¤=Ð1Ô2ä'ØØØ$7Ø'Ø'ôð ô �eœd¤E˜]Ô+Ü—H‘H˜U¬"¯*©*Ô5‰EÜ˜œrŸz™zÔ*Ø—L‘L¤§¡Ó,‰EÜ˜¤§¡¬"¯/©/Ð:Ô;Ü—H‘H˜UŸ_™_Ó.´b·j±jÔA‰EäÐ6´t¸E³{°mÐDÓEÐEä&Ø�5Ð,¨i¸ó
ð 	
rW   c                óz  — |dk(  r1t        |t        t        f«      st        dt	        |«      › �«      ‚||fS |dk(  r| j                  |||«      }||fS |dk(  rWt        |t        «      r|dfS |j                  j                  |«      }|�"|j                  j                  |«      d   }|dfS |dfS t        d|› �«      ‚)Nrs  z/'fts' query must be a string or FullTextQuery: r‡   Úautor   z8Invalid query_type, must be 'vector', 'fts', or 'auto': )r�   r    r   rà   r‰  Ú_query_to_vectorÚ_SYNC_VECTOR_QUERY_TYPESÚembedding_functionsÚgetÚfunctionÚ#compute_query_embeddings_with_retryrÆ   )ri  r{   r„   r"  r‹  Úconfs         rT   r€  z LanceQueryBuilder._resolve_query  sê   € ð ˜ÒÜ˜e¤c¬=Ð%9Ô:ÜØEÄdÈ5ÃkÀ]ÐSóð ð ˜*Ð$Ð$Ø˜8Ò#Ø×(Ñ(¨°Ð7IÓJˆEØ˜*Ð$Ð$Ø˜6Ò!Ü˜%Ô!9Ô:Ø˜h�Ð&à×0Ñ0×4Ñ4Ð5GÓH�ØÐ#Ø ŸM™M×MÑMÈeÓTÐUVÑW�EØ  (˜?Ð*à  %˜<Ð'äØJÈ:È,ÐWóð rW   c                ó¼   — t        |t        «      r|S |j                  j                  |«      }|�|j                  j                  |«      d   S d|› �}t        |«      ‚)Nr   zNo embedding function for )r�   r‘  r’  r“  r”  r•  rÆ   )ri  r{   r„   r‹  r–  Úmsgs         rT   r�  z"LanceQueryBuilder._query_to_vector1  sa   € ä�eÔ5Ô6ØˆLØ×(Ñ(×,Ñ,Ð-?Ó@ˆØÐØ—=‘=×DÑDÀUÓKÈAÑNÐNà.Ð/AÐ.BÐCˆCÜ˜S“/Ð!rW   c                óä   — || _         d | _        d | _        d | _        d | _        d | _        d | _        d | _        d | _        d | _	        d | _
        d | _        d | _        d | _        d | _        d | _        y rO   )ry   Ú_limitÚ_offsetÚ_columnsÚ_whereÚ_postfilterÚ_with_row_idÚ_with_row_addressÚ
_fragmentsÚ_fragment_idsÚ_use_rteÚ_vectorÚ_textÚ_efÚ_bypass_vector_indexÚ	_order_by)rQ   r{   s     rT   Ú__init__zLanceQueryBuilder.__init__<  sw   € ØˆŒØˆŒØˆŒØˆŒØˆŒØˆÔØ ˆÔØ!%ˆÔØˆŒØ!ˆÔØˆŒØˆŒØˆŒ
ØˆŒØ$(ˆÔ!Øˆ�rW   z0.3.1z0.4.0zUse to_pandas() instead)Údeprecated_inÚ
removed_inÚcurrent_versionÚdetailsc                ó"   — | j                  «       S )ae  
        *Deprecated alias for `to_pandas()`. Please use `to_pandas()` instead.*

        Execute the query and return the results as a pandas DataFrame.
        In addition to the selected columns, LanceDB also returns a vector
        and also the "_distance" column which is the distance between the query
        vector and the returned vector.
        )rU   rY   s    rT   Úto_dfzLanceQueryBuilder.to_dfN  s   € ð �~‰~ÓÐrW   rÑ   )rR   Útimeoutc               ó^  — t        |«       t        | j                  «      r1| j                  |«      }t	        | j                  |¬«      f|||dœ|¤ŽS t        | dd«      }|�Ht         |«       «      r8|�|dk7  r|€ | j                  |fd|i|¤Ž}|�|S t        | «      rt        d«      ‚|dk(  rdn|}| j                  ||«      }	|dk(  rJt        |	j                  «      r5t        | j                  j                  | j                  «      st        d	«      ‚ t        |	|«      j                   d
i |¤ŽS )aÙ  
        Execute the query and return the results as a pandas DataFrame.
        In addition to the selected columns, LanceDB also returns a vector
        and also the "_distance" column which is the distance between the query
        vector and the returned vector.

        Parameters
        ----------
        flatten: Optional[Union[int, bool]]
            If flatten is True, flatten all nested columns.
            If flatten is an integer, flatten the nested columns up to the
            specified depth.
            If unspecified, do not flatten the nested columns.
        timeout: Optional[timedelta]
            The maximum time to wait for the query to complete.
            If None, wait indefinitely.
        blob_mode: str, default "lazy"
            Controls how blob columns are returned. Local blob v2 queries support
            ``"bytes"`` and ``"descriptions"`` without pylance. Eligible local
            plain scans use pylance's scanner for lazy blob handles in ``"lazy"``
            mode and for legacy blob columns. Other local blob v2
            queries return descriptors in ``"lazy"`` and ``"descriptions"``
            modes, or payloads in ``"bytes"`` mode, through :meth:`to_arrow`.
            Remote blob queries support only ``"descriptions"`` until a stable
            table snapshot can bind the query and blob fetches.
        **kwargs
            Forwarded to pyarrow.Table.to_pandas after query execution and
            optional flattening.
        ©r°  ©rR   ró   rï   Úoutput_schemaNrÑ   rï   ú:this query shape cannot use Lance native pandas conversionrò   ú)the query has no fetchable blob v2 sourcerP   )r4   r|   ry   Ú_validated_blob_sourcesrô   Úto_arrowrz   r$   Ú_plain_scan_to_pandasr…   rl   Ú_to_arrow_in_moderM   r-   rœ  r&   rU   )
rQ   rï   rR   r°  rS   rì   r´  rÕ   Ú
arrow_moderã   s
             rT   rU   zLanceQueryBuilder.to_pandas_  sG  € ôJ 	˜9Ô%Ü! $§+¡+Ô.Ø×7Ñ7¸	ÓBˆLÜ(Ø—‘ g�Ó.ðà#Ø'Øñ	ð
 ñð ô    o°tÓ<ˆØÐ$Ô)>¹}»Ô)OØ� 9°Ò#6¸G¸OØ/�T×/Ñ/°	ÑUÀ7ÐUÈfÑU�Ø�>Ø�IÜ)¨$Ô/Ü4ØPóð ð (1°FÒ':‘^À	ˆ
Ø×$Ñ$ W¨jÓ9ˆà˜ÒÜ% c§j¡jÔ1Ü.¨t¯{©{×/AÑ/AÀ4Ç=Á=ÔQä0Ø;óð ð 7Œ˜s GÓ,×6Ñ6Ñ@¸Ñ@Ð@rW   ©r°  rR   c               ó   — t         ‚)á\  
        Execute the query and return the results as an
        [Apache Arrow Table](https://arrow.apache.org/docs/python/generated/pyarrow.Table.html#pyarrow.Table).

        In addition to the selected columns, LanceDB also returns a vector
        and also the "_distance" column which is the distance between the query
        vector and the returned vectors.

        Parameters
        ----------
        timeout: Optional[timedelta]
            The maximum time to wait for the query to complete.
            If None, wait indefinitely.
        blob_mode: str, default "lazy"
            ``"lazy"`` returns blob v2 descriptors that carry the row id
            ``fetch_blobs`` reads. ``"descriptions"`` returns them without it.
            ``"bytes"`` returns payload bytes and raises for legacy blob columns
            and blobs inside lists.
        ru   ©rQ   r°  rR   s      rT   r¸  zLanceQueryBuilder.to_arrow¦  s
   € ô4 "Ð!rW   c              ó   — t         ‚)aÇ  
        Execute the query and return the results as a pyarrow
        [RecordBatchReader](https://arrow.apache.org/docs/python/generated/pyarrow.RecordBatchReader.html)

        For v2 blob projections, the default ``blob_mode="lazy"`` keeps the
        auto ``_rowid`` column visible so batch consumers can call
        ``fetch_blobs``. The ``"bytes"`` and ``"descriptions"`` modes hide
        automatic row ids.

        Parameters
        ----------
        batch_size: int
            The maximum number of selected records in a RecordBatch object.
        timeout: Optional[timedelta]
            The maximum time to wait for the query to complete.
            If None, wait indefinitely.
        blob_mode: str, default "lazy"
            ``"lazy"`` keeps blob descriptors and auto row ids for manual fetches.
            ``"descriptions"`` omits auto row ids. ``"bytes"`` fetches blob v2
            payloads one batch at a time, without requiring pylance. Bytes mode
            has the same restrictions as :meth:`to_arrow`.

        Examples
        --------
        Stream blob payloads with ``query.to_batches(blob_mode="bytes")`` and
        convert each batch separately with ``batch.to_pandas()``.
        ru   ©rQ   Ú
batch_sizer°  rR   s       rT   Ú
to_batcheszLanceQueryBuilder.to_batchesÂ  s   € ôH "Ð!rW   c               óX   — t        |«       | j                  ||«      j                  «       S )aP  
        Execute the query and return the results as a list of dictionaries.

        Each list entry is a dictionary with the selected column names as keys,
        or all table columns if `select` is not called. The vector and the "_distance"
        fields are returned whether or not they're explicitly selected.

        Parameters
        ----------
        timeout: Optional[timedelta]
            The maximum time to wait for the query to complete.
            If None, wait indefinitely.
        blob_mode: str, default "lazy"
            Passed through to :meth:`to_arrow`.
        )r4   rº  rˆ  r¿  s      rT   Úto_listzLanceQueryBuilder.to_listè  s(   € ô* 	˜9Ô%Ø×%Ñ% g¨yÓ9×CÑCÓEÐErW   c                ó”   — |dk(  st        | j                  j                  «      s| j                  |¬«      S | j                  ||¬«      S )NrÑ   r²  r¼  )r$   ry   rM   r¸  r¿  s      rT   rº  z#LanceQueryBuilder._to_arrow_in_mode   sB   € ð ˜ÒÔ&;¸D¿K¹K×<NÑ<NÔ&OØ—=‘=¨�=Ó1Ð1Ø�}‰} W¸	ˆ}ÓBÐBrW   r²  c               ót   — | j                  |¬«      j                  «       D �cg c]
  } |di |¤Ž‘Œ c}S c c}w )al  Return the table as a list of pydantic models.

        Parameters
        ----------
        model: Type[LanceModel]
            The pydantic model to use.
        timeout: Optional[timedelta]
            The maximum time to wait for the query to complete.
            If None, wait indefinitely.

        Returns
        -------
        List[LanceModel]
        r²  rP   ©r¸  rˆ  ©rQ   Úmodelr°  r  s       rT   Úto_pydanticzLanceQueryBuilder.to_pydantic  s2   € ð" )-¯©¸g¨Ó(F×(PÑ(PÓ(RÖS ‘‘˜“ÒSÐSùÒSs   £5c               óN   — ddl } |j                  | j                  |¬«      «      S )aÈ  
        Execute the query and return the results as a Polars DataFrame.
        In addition to the selected columns, LanceDB also returns a vector
        and also the "_distance" column which is the distance between the query
        vector and the returned vector.

        Parameters
        ----------
        timeout: Optional[timedelta]
            The maximum time to wait for the query to complete.
            If None, wait indefinitely.
        r   Nr²  ©ÚpolarsÚ
from_arrowr¸  ©rQ   r°  Úpls      rT   Ú	to_polarszLanceQueryBuilder.to_polars  s#   € ó 	àˆr�}‰}˜TŸ]™]°7˜]Ó;Ó<Ð<rW   c                ój   — |�|dk  r$t        | t        «      rt        d«      ‚d| _        | S || _        | S )aÄ  Set the maximum number of results to return.

        Parameters
        ----------
        limit: int
            The maximum number of results to return.
            The default query limit is 10 results.
            For ANN/KNN queries, you must specify a limit.
            For plain searches, all records are returned if limit not set.
            *WARNING* if you have a large dataset, setting
            the limit to a large number, e.g. the table size,
            can potentially result in reading a
            large amount of data into memory and cause
            out of memory issues.

        Returns
        -------
        LanceQueryBuilder
            The LanceQueryBuilder object.
        Nr   z%Limit is required for ANN/KNN queries)r�   rŠ  rÆ   rš  ©rQ   rº   s     rT   rº   zLanceQueryBuilder.limit,  sB   € ð* ˆ=˜E QšJÜ˜$Ô 7Ô8Ü Ð!HÓIÐIà"�”ð ˆð  ˆDŒKØˆrW   c                ó4   — |�|dk  r	d| _         | S || _         | S )zÿSet the offset for the results.

        Parameters
        ----------
        offset: int
            The offset to start fetching results from.

        Returns
        -------
        LanceQueryBuilder
            The LanceQueryBuilder object.
        r   )r›  ©rQ   r»   s     rT   r»   zLanceQueryBuilder.offsetJ  s+   € ð ˆ>˜V qš[ØˆDŒLð ˆð "ˆDŒLØˆrW   c                ój   — t        |t        «      st        |t        «      r	|| _        | S t	        d«      ‚)aÊ  Set the columns to return.

        Parameters
        ----------
        columns: list of str, or dict of str to str or Expr
            List of column names to be fetched.
            Or a dictionary of column names to SQL expressions or
            :class:`~lancedb.expr.Expr` objects.
            All columns are fetched if None or unspecified.

        Returns
        -------
        LanceQueryBuilder
            The LanceQueryBuilder object.
        z&columns must be a list or a dictionary)r�   r«   Údictrœ  rÆ   ©rQ   r¦   s     rT   r´   zLanceQueryBuilder.select]  s3   € ô  �gœtÔ$¬
°7¼DÔ(AØ#ˆDŒMð ˆô ÐEÓFÐFrW   c                óL   — t        | j                  |«      | _        | | _        | S )a\  Set the where clause.

        Parameters
        ----------
        where: str or :class:`~lancedb.expr.Expr`
            The filter condition.  Can be a SQL string or a type-safe
            :class:`~lancedb.expr.Expr` built with :func:`~lancedb.expr.col`
            and :func:`~lancedb.expr.lit`.
        prefilter: bool, default True
            If True, apply the filter before vector search, otherwise the
            filter is applied on the result of vector search.
            This feature is **EXPERIMENTAL** and may be removed and modified
            without warning in the future.

        Returns
        -------
        LanceQueryBuilder
            The LanceQueryBuilder object.

        Notes
        -----
        Calling this multiple times combines the filters with a logical AND
        rather than replacing the previous filter.
        ©rœ   r�  rž  ©rQ   ÚwhereÚ	prefilters      rT   rÝ  zLanceQueryBuilder.wheres  s%   € ô2 % T§[¡[°%Ó8ˆŒØ(˜=ˆÔØˆrW   c                ó   — || _         | S )a  Set whether to return row ids.

        Parameters
        ----------
        with_row_id: bool
            If True, return _rowid column in the results.

        Returns
        -------
        LanceQueryBuilder
            The LanceQueryBuilder object.
        ©rŸ  )rQ   r¸   s     rT   r¸   zLanceQueryBuilder.with_row_id�  s   € ð (ˆÔØˆrW   c                ó   — | j                   du S ©NTrà  rY   s    rT   Ú_user_requested_row_idz(LanceQueryBuilder._user_requested_row_id   ó   € Ø× Ñ  DÐ(Ð(rW   c                ón   — t        | j                  j                  | j                  | j                  ¬«      S )Nr·   )r,   ry   rM   rœ  rŸ  rY   s    rT   Ú_blob_auto_row_id_enabledz+LanceQueryBuilder._blob_auto_row_id_enabled£  s,   € Ü(Ø�K‰K×ÑØ�M‰MØ×)Ñ)ô
ð 	
rW   c                óF   — | j                  «       xs | j                  «       S rO   )rã  ræ  rY   s    rT   Ú_scan_needs_row_idz$LanceQueryBuilder._scan_needs_row_idª  s   € Ø×*Ñ*Ó,ÒP°×0NÑ0NÓ0PÐPrW   c                óT   — | j                  «       }| j                  «       rd|_        |S râ  )r~   rè  r¸   ©rQ   r„   s     rT   Ú_query_for_scanz!LanceQueryBuilder._query_for_scan­  s)   € Ø×$Ñ$Ó&ˆØ×"Ñ"Ô$Ø $ˆEÔØˆrW   c                óf  — t        |«       | j                  j                  }t        || j                  «      }|dk7  r|S t        || j                  |«       |r?t        | j                  j                  t        | j                  dd«      «      s
t        «       ‚t        | j                  «       |«       |S )ú{Map projected blob v2 outputs to their source columns.

        Bytes mode is checked here, before the query runs.
        ÚbytesÚ_pushdown_operationsrP   )r4   ry   rM   r-   rœ  r/   rs   rz   rw   r0   Ú_blob_output_schema)rQ   rR   rM   rì   s       rT   r·  z)LanceQueryBuilder._validated_blob_sources³  s•   € ô
 	˜9Ô%Ø—‘×#Ñ#ˆÜ1°&¸$¿-¹-ÓHˆØ˜ÒØÐÜ'¨°·±¸|ÔLÙÔ :Ø�K‰K×Ñ¤¨¯©Ð5KÈRÓ Pô!
ô 5Ó6Ð6Ü% d×&>Ñ&>Ó&@À,ÔOØÐrW   c                ó"   — | j                  «       S rO   ©r´  rY   s    rT   rð  z%LanceQueryBuilder._blob_output_schemaÅ  s   € Ø×!Ñ!Ó#Ð#rW   c                ót   — |dk(  r|S |dk(  rt        ||«      S t        ||| j                  j                  «      S ©NrÑ   rò   )r3   r2   ry   rí   ©rQ   rã   rR   rì   s       rT   Ú_apply_arrow_blob_modez(LanceQueryBuilder._apply_arrow_blob_modeÈ  sD   € ð ˜ÒØˆJØ˜Ò&Ü% c¨<Ó8Ð8Ü6Ø�˜tŸ{™{×6Ñ6ó
ð 	
rW   c               ó  — | j                  «       }t        || j                  «       ||r|j                  «       nd¬«      }| j	                  |||«      }|dk7  r.| j
                  du r d|j                  v r|j                  dg«      }|S )NrP   ©Úuser_requested_row_idÚblob_auto_row_idró   rÑ   Frç   )ræ  r.   rã  Úkeysrö  rŸ  rè   ré   )rQ   rã   rR   rì   rú  Ú	finalizeds         rT   Ú_finalize_blob_query_tablez,LanceQueryBuilder._finalize_blob_query_tableÓ  s“   € ð  ×9Ñ9Ó;ÐÜ-ØØ"&×"=Ñ"=Ó"?Ø-Ù.>�|×(Ñ(Ô*ÀBô	
ˆ	ð ×/Ñ/°	¸9ÀlÓSˆ	ð ˜ÒØ×!Ñ! UÑ*Ø˜I×2Ñ2Ñ2à!×.Ñ.°¨zÓ:ˆIØÐrW   c                óö   ‡ ‡‡‡‡— ‰dk(  r‰S dˆˆˆ fd„Š ‰t         j                  j                  g ‰j                  ¬«      «      j                  }ˆˆfd„}t         j                  j                  | |«       «      S )NrÑ   c                ó,   •— ‰j                  | ‰‰¬«      S )N©rR   rì   )rý  ©rã   rR   rì   rQ   s    €€€rT   Úconvertz3LanceQueryBuilder._batches_in_mode.<locals>.convertõ  s"   ø€ Ø×2Ñ2Ø˜y°|ð 3ó ð rW   ©rM   c               3  ó˜   •K  — ‰D ]>  }  ‰t         j                  j                  | g«      «      j                  «       E d {  –—†  Œ@ y 7 Œ­wrO   ©rù   r@   Úfrom_batchesrÃ  )Úbatchr  rÛ   s    €€rT   Úbatchesz3LanceQueryBuilder._batches_in_mode.<locals>.batchesü  sC   øè ø€ Øò P�Ù"¤2§8¡8×#8Ñ#8¸%¸Ó#AÓB×MÑMÓO×OÑOñPØOús   ƒ=A
Á AÁA
©rã   ra   r_   ra   )rù   r@   r  rM   ÚRecordBatchReader)rQ   rÛ   rR   rì   rM   r  r  s   ````  @rT   Ú_batches_in_modez"LanceQueryBuilder._batches_in_modeì  sd   ü€ ð ˜ÒØˆM÷	ñ
 œŸ™×.Ñ.¨r¸&¿-¹-Ð.ÓHÓI×PÑPˆõ	Pô ×#Ñ#×0Ñ0°¹»ÓCÐCrW   c                ó   — || _         | S )a&  Set whether to return row addresses.

        Parameters
        ----------
        with_row_address: bool, default True
            If True, return the _rowaddr column in the results.

        Returns
        -------
        LanceQueryBuilder
            The LanceQueryBuilder object.
        ©r   ©rQ   r‚   s     rT   r‚   z"LanceQueryBuilder.with_row_address  s   € ð "2ˆÔØˆrW   c                ó   — || _         | S )zASet the Lance fragments to scan for plain scanner-backed queries.©r¡  ©rQ   r   s     rT   Úwith_fragmentsz LanceQueryBuilder.with_fragments  s   € à#ˆŒØˆrW   c                ó   — || _         | S )zDSet the Lance fragment ids to scan for plain scanner-backed queries.©r¢  ©rQ   r€   s     rT   r€   zLanceQueryBuilder.fragment_ids  s   € à)ˆÔØˆrW   c                ó   — || _         | S )aø  Control RTE LSM read routing for this query.

        By default (unset), a query against a table with an RTE write spec is
        routed through the LSM scanner so it also returns data written via the
        ``merge_insert`` LSM path that has not yet been compacted into the base
        table (active/frozen memtables + SSTables); a table without a
        spec reads the base table.

        Parameters
        ----------
        enable : bool
            ``True`` forces the LSM scanner and errors if the table has no RTE
            write spec. ``False`` bypasses the RTE and reads the base table
            only, even when a spec is present.

        Returns
        -------
        LanceQueryBuilder
            The LanceQueryBuilder object.
        )r£  ©rQ   Úenables     rT   rb  zLanceQueryBuilder.use_rte  s   € ð* ˆŒØˆrW   c                óX   — | j                   j                  | j                  «       |¬«      S )áì  Return the execution plan for this query.

        Examples
        --------
        >>> import lancedb
        >>> db = lancedb.connect("./.lancedb")
        >>> table = db.create_table("my_table", [{"vector": [99.0, 99]}])
        >>> query = [100, 100]
        >>> plan = table.search(query).explain_plan(True)
        >>> print(plan) # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
        ProjectionExec: expr=[vector@0 as vector, _distance@2 as _distance]
          GlobalLimitExec: skip=0, fetch=10
            FilterExec: _distance@2 IS NOT NULL
              SortExec: TopK(fetch=1), expr=[_distance@2 ASC NULLS LAST, _rowid@1 ASC NULLS LAST], preserve_partitioning=[false]
                KNNVectorDistance: metric=l2
                  LanceRead: uri=..., projection=[vector], num_fragments=..., ...
        <BLANKLINE>

        Parameters
        ----------
        verbose : bool, default False
            Use a verbose output format.

        Returns
        -------
        plan : str
        ©Úverbose)ry   Ú_explain_planr~   ©rQ   r  s     rT   Úexplain_planzLanceQueryBuilder.explain_plan4  s'   € ð8 �{‰{×(Ñ(¨×)=Ñ)=Ó)?ÈÐ(ÓQÐQrW   c                ó   — || _         | S )a_  
        Set the ordering for the results.

        Parameters
        ----------
        ordering: Optional[List[ColumnOrdering]]
            The ordering to use for the results.  If None, then the default ordering
            will be used.

        Returns
        -------
        LanceQueryBuilder
            The LanceQueryBuilder object.
        )r¨  )rQ   Úorderings     rT   r‹   zLanceQueryBuilder.order_byR  s   € ð "ˆŒØˆrW   c                óX   — | j                   j                  | j                  «       |¬«      S )aÕ	  
        Run the query and return its execution plan with runtime metrics.

        This returns detailed metrics for each step, such as elapsed time,
        rows processed, bytes read, and I/O stats. It is useful for debugging
        and performance tuning.

        Examples
        --------
        >>> import lancedb
        >>> db = lancedb.connect("./.lancedb")
        >>> table = db.create_table("my_table", [{"vector": [99.0, 99]}])
        >>> query = [100, 100]
        >>> plan = table.search(query).analyze_plan()
        >>> print(plan)  # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
        AnalyzeExec verbose=true, elapsed=..., metrics=...
          TracedExec, elapsed=..., metrics=...
            ProjectionExec: elapsed=..., expr=[...],
            metrics=[output_rows=..., elapsed_compute=..., output_bytes=...]
              GlobalLimitExec: elapsed=..., skip=0, fetch=10,
              metrics=[output_rows=..., elapsed_compute=..., output_bytes=...]
                FilterExec: elapsed=..., _distance@2 IS NOT NULL, metrics=[...]
                  SortExec: elapsed=..., TopK(fetch=1), expr=[...],
                  preserve_partitioning=[...], filter=[...],
                  metrics=[output_rows=..., elapsed_compute=...,
                  output_bytes=..., row_replacements=...]
                    KNNVectorDistance: elapsed=..., metric=l2,
                    metrics=[output_rows=..., elapsed_compute=...,
                    output_bytes=..., output_batches=...]
                      LanceRead: elapsed=..., uri=..., projection=[vector],
                      num_fragments=..., range_before=None, range_after=None,
                      row_id=true, row_addr=false,
                      full_filter=--, refine_filter=--,
                      metrics=[output_rows=..., elapsed_compute=..., output_bytes=...,
                      fragments_scanned=..., ranges_scanned=1, rows_scanned=1,
                      bytes_read=..., iops=..., requests=..., task_wait_time=...]
        <BLANKLINE>

        Parameters
        ----------
        distributed_metrics : Literal["aggregate", "per_worker", "full"]
            Defaults to "aggregate".
            How distributed worker metrics are displayed for remote query plans.
            "aggregate" preserves the legacy summary, "per_worker" shows each
            worker separately, and "full" includes both.

        Returns
        -------
        plan : str
            The physical query execution plan with runtime metrics.
        ©Údistributed_metrics)ry   Ú_analyze_planr~   ©rQ   r$  s     rT   Úanalyze_planzLanceQueryBuilder.analyze_pland  s0   € ðl �{‰{×(Ñ(Ø× Ñ Ó"Ð8Kð )ó 
ð 	
rW   c                ó   — t         ‚)a  Set the vector to search for.

        Parameters
        ----------
        vector: list, tuple, np.ndarray, pa.Array, or pa.ChunkedArray
            The vector to search for.

        Returns
        -------
        LanceQueryBuilder
            The LanceQueryBuilder object.
        ru   ©rQ   r‡   s     rT   r‡   zLanceQueryBuilder.vectorž  s
   € ô "Ð!rW   c                ó   — t         ‚)aF  Set the text to search for.

        Parameters
        ----------
        text: str | FullTextQuery
            If a string, it is treated as a MatchQuery.
            If a FullTextQuery object, it is used directly.

        Returns
        -------
        LanceQueryBuilder
            The LanceQueryBuilder object.
        ru   ©rQ   Útexts     rT   r,  zLanceQueryBuilder.text­  ó
   € ô "Ð!rW   c                ó   — t         ‚)zäRerank the results using the specified reranker.

        Parameters
        ----------
        reranker: Reranker
            The reranker to use.

        Returns
        -------

        The LanceQueryBuilder object.
        ru   ©rQ   Úrerankers     rT   ÚrerankzLanceQueryBuilder.rerank½  r-  rW   c                ó–  — | j                  «       }t        |«      sy | j                  j                  j                  j	                  «       r"t        | j                  j                  «      dk(  ry |dk7  r6t        | «      s+t        | j                  j                  |j                  «      ry 	 | j                  j                  «       }| j                  «       }|dk(  r*t        | j                  j                  |j                  «      ni }|r+t!        | j                  j                  |j                  |«        |j"                  di t%        ||rdn|||j&                  xs |xs t)        |«      ¬«      ¤Ž}	t+        |	f||| j                  j,                  | j/                  «        |dœ|¤ŽS # t        $ r}t        t        |«      «      |‚d }~ww xY w)NÚmemoryrÑ   rî  rò   r·   ©rR   rì   rí   rî   rï   rP   )r~   rŒ   ry   ro   rp   r'   Ú_dataset_pathr…   r-   rM   r¦   Úto_lanceÚImportErrorrl   r    ræ  r/   rÚ   rÂ   r¸   r�   rð   rí   rã  )
rQ   rR   rï   rS   r„   r¿   rá   rú  rì   rÚ   s
             rT   r¹  z'LanceQueryBuilder._plain_scan_to_pandasÍ  s©  € ð ×$Ñ$Ó&ˆÜ# EÔ*Øð �{‰{×!Ñ!×(Ñ(×3Ñ3Ô5Ü˜4Ÿ;™;×4Ñ4Ó5¸ÒAàð ˜ÒÜ.¨tÔ4Ü*¨4¯;©;×+=Ñ+=¸u¿}¹}ÔMàð	DØ—k‘k×*Ñ*Ó,ˆGð  ×9Ñ9Ó;Ðð ˜GÒ#ô ' t§{¡{×'9Ñ'9¸5¿=¹=ÔIàð 	ñ
 Ü+Ø—‘×"Ñ" E§M¡M°<ôð "�'—/‘/ñ 
Ü'ØÙ".‘°IØØ!×-Ñ-ÒWÐ1AÒWÄTÈ,ÓEWô	ñ
ˆô )Øð
àØ%ØŸ™×/Ñ/Ø"&×"=Ñ"=Ó"?Ð?Øñ
ð ñ
ð 	
øô) ò 	DÜ0´°S³Ó:ÀÐCûð	Dús   Â*F% Æ%	GÆ.GÇGc                ó   — t         ‚)z¢Return a serializable representation of the query

        Returns
        -------
        Query
            The serializable representation of the query
        ru   rY   s    rT   r~   z!LanceQueryBuilder.to_query_object  s
   € ô "Ð!rW   ©NNN)r{   ú'Table'r„   z:Optional[Union[np.ndarray, str, 'PIL.Image.Image', Tuple]]r"  r    r‹  r    rx  r1  rw  úOptional[Union[str, List[str]]]r¼   r�   r_   rC   )r{   r:  )r_   ú'pd.DataFrame'rO   )rï   úOptional[Union[int, bool]]rR   r5   r°  úOptional[timedelta]r_   r<  ©r°  r>  rR   r5   r_   ra   ©rÂ  r4  r°  r>  rR   r5   r_   úpa.RecordBatchReader©r°  r>  rR   r5   r_   z
List[dict])rÊ  ztype[T]r°  r>  r_   zlist[T]©r°  r>  r_   z'pl.DataFrame')rº   zUnion[int, None]r_   rC   ©r»   r7  r_   rC   )r¦   z-Union[list[str], dict[str, Union[str, Expr]]]r_   rC   ©T)rÝ  úUnion[str, Expr]rÞ  r�   r_   rC   ©r¸   r�   r_   rC   ©r_   r�   ©r_   r:   ©rR   r5   r_   údict[str, str]©r_   ú	pa.Schema©rã   ra   rR   r5   rì   rK  r_   ra   )rÛ   rA  rR   r5   rì   rK  r_   rA  ©r‚   r�   r_   rC   ©r   r
   r_   rC   ©r€   z	List[int]r_   rC   ©r  r�   r_   rC   ©F©r  rW  r_   r    ©r!  re  r_   rC   ©rF   ©r$  ÚAnalyzePlanDistributedMetricsr_   r    )r‡   úUnion[VEC, Tuple]r_   rC   )r,  ústr | FullTextQueryr_   rC   )r0  r   r_   rC   ©rR   r5   rï   r=  r_   zOptional['pd.DataFrame'])/rb   rc   rd   r  rm  r�  r€  r�  r©  ÚdeprecationÚ
deprecatedr   r¯  rU   r   r¸  rÃ  rÅ  rº  rË  rÒ  rº   r»   r´   rÝ  r¸   rã  ræ  rè  rë  r·  rð  rö  rý  r  r‚   r  r€   rb  r  r‹   r'  r‡   r,  r1  r¹  r~   rP   rW   rT   rq  rq  ´  s|  „ ñð ð .2Ø7;Ø ðY
àðY
ð JðY
ð ð	Y
ð
  ðY
ð +ðY
ð 5ðY
ð ðY
ð 
òY
ó ðY
ðv ñó ðð6 ñ"ó ð"óð$ €[×ÑØØØ#Ø)ô	ò	 óð	 ð /3ðEAð %Ø'+ñEAà+ðEAð ð	EAð
 %ðEAð 
óEAðN ð (,Ø$ñ	"ð %ð"ð ð	"ð
 
ò"ó ð"ð6 ð %)ð#"ð
 (,Ø$ñ#"ð "ð#"ð
 %ð#"ð ð#"ð 
ò#"ó ð#"ðP (,Ø$ñ	Fð %ðFð ð	Fð
 
óFð0CØ*ðCØ7?ðCà	óCð AEñTØðTØ*=ðTà	óTð& ;?õ =ó"ó<ó&ô,ó:ó )ó
óQóóó$$ð	
Øð	
Ø(0ð	
Ø@Nð	
à	ó	
ðàðð ð	ð
 %ðð 
óð2Dà$ðDð ðDð %ð	Dð
 
óDô,ó ó
ó
ô0Ró<ð& DOð8
Ø#@ð8
à	ó8
ót"ó"ð  ò"ó ð"ð$ /3ð5
àð5
ð ,ð5
ð
 
"ó5
ðn ò"ó ñ"rW   rq  c                  ó"  ‡ — e Zd ZdZ	 	 d	 	 	 	 	 	 	 	 	 dˆ fd„Zdd„Z	 	 	 	 dd„Zdd„Zdd„Zdd„Z	dd	„Z
	 d	 	 	 	 	 dd
„Zd d„Zd!d„Zd"d„Zdddœ	 	 	 	 	 d#d„Zd$d„Z	 d%dddœ	 	 	 	 	 	 	 d&d„Z	 d%	 	 	 	 	 d'd„Z	 d%	 	 	 	 	 d(d„Zd)d„Zd)d„Zˆ xZS )*rŠ  a|  
    Examples
    --------
    >>> import lancedb
    >>> data = [{"vector": [1.1, 1.2], "b": 2},
    ...         {"vector": [0.5, 1.3], "b": 4},
    ...         {"vector": [0.4, 0.4], "b": 6},
    ...         {"vector": [0.4, 0.4], "b": 10}]
    >>> db = lancedb.connect("./.lancedb")
    >>> table = db.create_table("my_table", data=data)
    >>> (table.search([0.4, 0.4])
    ...       .distance_type("cosine")
    ...       .where("b < 10")
    ...       .select(["b", "vector"])
    ...       .limit(2)
    ...       .to_pandas())
       b      vector  _distance
    0  6  [0.4, 0.4]   0.000000
    1  2  [1.1, 1.2]   0.000944
    Nc                óþ   •— t        |«       t        ‰| �	  |«       || _        d | _        d | _        d | _        d | _        d | _        d | _	        d | _
        d | _        || _        d | _        d | _        || _        || _        y rO   )r%   Úsuperr©  Ú_queryÚ_distance_typeÚ_nprobesÚ_minimum_nprobesÚ_maximum_nprobesÚ_search_effortÚ_lower_boundÚ_upper_boundÚ_refine_factorÚ_vector_columnrž  Ú	_rerankerÚ
_str_queryÚ_fast_search)rQ   r{   r„   rU  rŒ  r¼   Ú	__class__s         €rT   r©  z LanceVectorQueryBuilder.__init__&  s†   ø€ ô 	˜uÔ%Ü‰Ñ˜ÔØˆŒØ"ˆÔØˆŒØ $ˆÔØ $ˆÔØ"ˆÔØ ˆÔØ ˆÔØ"ˆÔØ+ˆÔØˆÔØˆŒØ#ˆŒØ'ˆÕrW   c                ó$   — | j                  |«      S ©a¤  Set the distance metric to use.

        This is an alias for distance_type() and may be deprecated in the future.
        Please use distance_type() instead.

        Parameters
        ----------
        metric: "l2" or "cosine" or "dot"
            The distance metric to use. By default "l2" is used.

        Returns
        -------
        LanceVectorQueryBuilder
            The LanceQueryBuilder object.
        ©rX  ©rQ   Úmetrics     rT   rs  zLanceVectorQueryBuilder.metric?  ó   € ð  ×!Ñ! &Ó)Ð)rW   c                ó0   — |j                  «       | _        | S ©aµ  Set the distance metric to use.

        When performing a vector search we try and find the "nearest" vectors according
        to some kind of distance metric. This parameter controls which distance metric
        to use.

        Note: if there is a vector index then the distance type used MUST match the
        distance type used to train the vector index. If this is not done then the
        results will be invalid.

        Parameters
        ----------
        distance_type: "l2" or "cosine" or "dot"
            The distance metric to use. By default "l2" is used.

        Returns
        -------
        LanceVectorQueryBuilder
            The LanceQueryBuilder object.
        ©Úlowerrb  ©rQ   rX  s     rT   rX  z%LanceVectorQueryBuilder.distance_typeQ  ó   € ð. ,×1Ñ1Ó3ˆÔØˆrW   c                ó4   — |dk  rt        d«      ‚|| _        | S )aå  Set the number of probes to use.

        Higher values will yield better recall (more likely to find vectors if
        they exist) at the expense of latency.

        See discussion in [Querying an ANN Index](https://lancedb.com/docs/indexing/)
        for tuning advice.

        The value is retained as `nprobes` through client and server request
        construction. Lance sets both probe bounds to this value. Explicit minimum
        or maximum settings can override their respective bounds.

        Parameters
        ----------
        nprobes: int
            The number of probes to use. Must be greater than 0.

        Returns
        -------
        LanceVectorQueryBuilder
            The LanceQueryBuilder object.
        r   ú-Invalid input, nprobes must be greater than 0©rÆ   rc  ©rQ   rY  s     rT   rY  zLanceVectorQueryBuilder.nprobesk  s#   € ð. �aŠ<ÜÐLÓMÐMØˆŒØˆrW   c                ó   — || _         | S )a:  Set the initial IVF search effort to a finite value in [0, 1].

        None (the default) uses Auto, internally 0.5. Zero starts at the caller
        minimum; one searches all partitions within the caller maximum. Later
        probing may continue when too few candidates are found. Any explicit
        effort, including 0.5, overrides nprobes in either call order. Explicit
        minimum and maximum bounds still apply. This is not a recall guarantee
        and does not change refinement or HNSW ef. RTE LSM queries do not
        yet support this option.

        Examples
        --------
        >>> import lancedb
        >>> db = lancedb.connect("memory://")
        >>> table = db.create_table("effort_vectors", [{"vector": [0.1, 0.2]}])
        >>> query = table.search([0.1, 0.2]).search_effort(0.75)
        ©rf  ©rQ   r]  s     rT   r]  z%LanceVectorQueryBuilder.search_effort‡  s   € ð$ ,ˆÔØˆrW   c                ó   — || _         | S )z×Set the minimum number of probes to use.

        See `nprobes` for more details.

        These partitions will be searched on every vector query and will increase recall
        at the expense of latency.
        ©rd  ©rQ   rZ  s     rT   rZ  z'LanceVectorQueryBuilder.minimum_nprobesœ  s   € ð !0ˆÔØˆrW   c                ó   — || _         | S ©a  Set the maximum number of probes to use.

        See `nprobes` for more details.

        If this value is greater than `minimum_nprobes` then the excess partitions
        will be searched only if we have not found enough results.

        This can be useful when there is a narrow filter to allow these queries to
        spend more time searching and avoid potential false negatives.

        If this value is 0 then no limit will be applied and all partitions could be
        searched if needed to satisfy the limit.
        ©re  ©rQ   r[  s     rT   r[  z'LanceVectorQueryBuilder.maximum_nprobes§  s   € ð !0ˆÔØˆrW   c                ó"   — || _         || _        | S )aÍ  Set the distance range to use.

        Only rows with distances within range [lower_bound, upper_bound)
        will be returned.

        Parameters
        ----------
        lower_bound: Optional[float]
            The lower bound of the distance range.
        upper_bound: Optional[float]
            The upper bound of the distance range.

        Returns
        -------
        LanceVectorQueryBuilder
            The LanceQueryBuilder object.
        ©rg  rh  ©rQ   r^  r_  s      rT   Údistance_rangez&LanceVectorQueryBuilder.distance_range¸  s   € ð( (ˆÔØ'ˆÔØˆrW   c                ó   — || _         | S )a  Set the number of candidates to consider during search.

        Higher values will yield better recall (more likely to find vectors if
        they exist) at the expense of latency.

        This only applies to the HNSW-related index.
        The default value is 1.5 * limit.

        Parameters
        ----------
        ef: int
            The number of candidates to consider during search.

        Returns
        -------
        LanceVectorQueryBuilder
            The LanceQueryBuilder object.
        ©r¦  ©rQ   rc  s     rT   rc  zLanceVectorQueryBuilder.efÐ  s   € ð& ˆŒØˆrW   c                ó   — || _         | S )a6  Set the refine factor to use, increasing the number of vectors sampled.

        As an example, a refine factor of 2 will sample 2x as many vectors as
        requested, re-ranks them, and returns the top half most relevant results.

        See discussion in [Querying an ANN Index](https://lancedb.com/docs/indexing/)
        for tuning advice.

        Parameters
        ----------
        refine_factor: int
            The refine factor to use.

        Returns
        -------
        LanceVectorQueryBuilder
            The LanceQueryBuilder object.
        ©ri  ©rQ   r`  s     rT   r`  z%LanceVectorQueryBuilder.refine_factoræ  s   € ð& ,ˆÔØˆrW   c                óT   — | j                   j                  | j                  «       «      S ©úb
        Return the output schema for the query

        This does not execute the query.
        ©ry   Ú_output_schemar~   rY   s    rT   r´  z%LanceVectorQueryBuilder.output_schemaü  ó"   € ð �{‰{×)Ñ)¨$×*>Ñ*>Ó*@ÓAÐArW   rÑ   r¼  c               óˆ   — | j                  |«      }| j                  | j                  |¬«      j                  «       ||¬«      S )r¾  r²  r   ©r·  rý  rÃ  rÙ   ©rQ   r°  rR   rì   s       rT   r¸  z LanceVectorQueryBuilder.to_arrow  sI   € ð2 ×3Ñ3°IÓ>ˆØ×.Ñ.Ø�O‰O GˆOÓ,×5Ñ5Ó7ØØ%ð /ó 
ð 	
rW   c                ón  — t        | j                  t        «      r| j                  n| j                  j                  «       }t        |d   t        j
                  «      r|D �cg c]  }|j                  «       ‘Œ }}t        di d|“d| j                  “d| j                  “d| j                  “d| j                  “d| j                  “d| j                  “d	| j                  “d
| j                  “d| j                  “d| j                   “d| j"                  “d| j$                  “d| j&                  “d| j(                  “d| j*                  “d| j,                  “d| j.                  “d| j0                  “d| j2                  “d| j4                  “d| j6                  “d| j8                  “d| j:                  “ŽS c c}w )zU
        Build a Query object

        This can be used to serialize a query
        r   r‡   r‘   rŠ   rº   rX  r¦   rY  rZ  r[  r]  r^  r_  r`  rU  r¸   r‚   r   r€   rb  r»   r¼   rc  rd  r‹   rP   )r�   ra  r«   Útolistr‚  r…  r:   r�  rž  rš  rb  rœ  rc  rd  re  rf  rg  rh  ri  rj  rŸ  r   r¡  r¢  r£  r›  rm  r¦  r§  r¨  )rQ   r‡   Úvs      rT   r~   z'LanceVectorQueryBuilder.to_query_object$  sÊ  € ô !+¨4¯;©;¼Ô =�—’À4Ç;Á;×CUÑCUÓCWˆÜ�f˜Q‘i¤§¡Ô,Ø*0Ö1 Q�a—h‘h•jÐ1ˆFÐ1Üò 
Ùð
à—;’;ð
ð ×'Ò'ð
ð —+’+ð	
ð
 ×-Ò-ð
ð —M’Mð
ð —M’Mð
ð !×1Ò1ð
ð !×1Ò1ð
ð ×-Ò-ð
ð ×)Ò)ð
ð ×)Ò)ð
ð ×-Ò-ð
ð ×-Ò-ð
ð ×)Ò)ð
ð  "×3Ò3ð!
ð" —o’oð#
ð$ ×+Ò+ð%
ð& —M’Mð'
ð( —<’<ð)
ð* ×)Ò)ð+
ð, �xŠxð-
ð. !%× 9Ò 9ð/
ð0 —^’^ð1
ð 	
ùò 2s   Á"F2c              ó®  — | j                  |«      }t        | j                  t        «      r| j                  n| j                  j	                  «       }t        |d   t
        j                  «      r|D �cg c]  }|j	                  «       ‘Œ }}| j                  «       }| j                  j                  |||¬«      }| j                  �y|j                  «       }	| j                  j                  | j                  |	«      }t        |«       t        j                   j#                  |j$                  |j'                  «       «      }| j)                  |||«      S c c}w )a@  
        Execute the query and return the result as a RecordBatchReader object.

        Parameters
        ----------
        batch_size: int
            The maximum number of selected records in a RecordBatch object.
        timeout: timedelta, default None
            The maximum time to wait for the query to complete.
            If None, wait indefinitely.
        blob_mode: str, default "lazy"
            Controls blob conversion as described in
            :meth:`LanceQueryBuilder.to_batches`.

        Returns
        -------
        pa.RecordBatchReader
        r   ©rÂ  r°  )r·  r�   ra  r«   r�  r‚  r…  rë  ry   Ú_execute_queryrk  rÙ   Úrerank_vectorrl  r!   rù   r
  r  rM   rÃ  r  )
rQ   rÂ  r°  rR   rì   r‡   rž  r„   Ú
result_setÚrs_tables
             rT   rÃ  z"LanceVectorQueryBuilder.to_batchesH  s  € ð4 ×3Ñ3°IÓ>ˆÜ *¨4¯;©;¼Ô =�—’À4Ç;Á;×CUÑCUÓCWˆÜ�f˜Q‘i¤§¡Ô,Ø*0Ö1 Q�a—h‘h•jÐ1ˆFÐ1Ø×$Ñ$Ó&ˆØ—[‘[×/Ñ/Ø˜j°'ð 0ó 
ˆ
ð �>‰>Ð%Ø!×*Ñ*Ó,ˆHØŸ™×5Ñ5°d·o±oÀxÓPˆJÜ! *Ô-ä×-Ñ-×:Ñ:Ø×!Ñ! :×#8Ñ#8Ó#:óˆJð ×$Ñ$ Z°¸LÓIÐIùò 2s   Á3Ec                óP   — t        | j                  |«      | _        |�| | _        | S )aä  Set the where clause.

        Parameters
        ----------
        where: str or :class:`~lancedb.expr.Expr`
            The filter condition.  Can be a SQL string or a type-safe
            :class:`~lancedb.expr.Expr` built with :func:`~lancedb.expr.col`
            and :func:`~lancedb.expr.lit`.
        prefilter: bool, default True
            If True, apply the filter before vector search, otherwise the
            filter is applied on the result of vector search.

        Returns
        -------
        LanceQueryBuilder
            The LanceQueryBuilder object.

        Notes
        -----
        Calling this multiple times combines the filters with a logical AND
        rather than replacing the previous filter.
        rÛ  rÜ  s      rT   rÝ  zLanceVectorQueryBuilder.whereu  s+   € ô2 % T§[¡[°%Ó8ˆŒØÐ Ø#,˜}ˆDÔØˆrW   c                óê   — || _         | j                  €|€t        d«      ‚|�t        |t        «      st        d«      ‚|�|n| j                  | _        |j
                  dk(  r| j                  d«       | S )aÎ  Rerank the results using the specified reranker.

        Parameters
        ----------
        reranker: Reranker
            The reranker to use.

        query_string: Optional[str]
            The query to use for reranking. This needs to be specified explicitly here
            as the query used for vector search may already be vectorized and the
            reranker requires a string query.
            This is only required if the query used for vector search is not a string.
            Note: This doesn't yet support the case where the query is multimodal or a
            list of vectors.

        Returns
        -------
        LanceVectorQueryBuilder
            The LanceQueryBuilder object.
        z¦
                The query used for vector search is not a string.
                In this case, the reranker query needs to be specified explicitly.
                z0Reranking currently only supports string queriesr¬   T)rk  rl  rÆ   r�   r    Úscorer¸   ©rQ   r0  Úquery_strings      rT   r1  zLanceVectorQueryBuilder.rerank“  sz   € ð. "ˆŒØ�?‰?Ð" |Ð';Üðóð ð Ð#¬J°|ÄSÔ,IÜÐOÓPÐPØ*6Ð*B™,ÈÏÉˆŒØ�>‰>˜UÒ"Ø×Ñ˜TÔ"ØˆrW   c                ó   — d| _         | S )a<  
        If this is called then any vector index is skipped

        An exhaustive (flat) search will be performed.  The query vector will
        be compared to every vector in the table.  At high scales this can be
        expensive.  However, this is often still useful.  For example, skipping
        the vector index can give you ground truth results which you can use to
        calculate your recall to select an appropriate value for nprobes.

        Returns
        -------
        LanceVectorQueryBuilder
            The LanceVectorQueryBuilder object.
        T©r§  rY   s    rT   rd  z+LanceVectorQueryBuilder.bypass_vector_index¹  ó   € ð %)ˆÔ!ØˆrW   c                ó   — d| _         | S )a	  
        Skip a flat search of unindexed data. This will improve
        search performance but search results will not include unindexed data.

        Returns
        -------
        LanceVectorQueryBuilder
            The LanceVectorQueryBuilder object.
        T©rm  rY   s    rT   r¼   z#LanceVectorQueryBuilder.fast_searchË  ó   € ð !ˆÔØˆrW   ©NN)
r{   r:  r„   z*Union[np.ndarray, list, 'PIL.Image.Image']rU  r    rŒ  r1  r¼   r�   )rs  úLiteral['l2', 'cosine', 'dot']r_   rŠ  )rX  r±  r_   z'LanceVectorQueryBuilder')rY  r7  r_   rŠ  )r]  r\  r_   rŠ  )rZ  r7  r_   rŠ  )r[  r7  r_   rŠ  )r^  r\  r_  r\  r_   rŠ  )rc  r7  r_   rŠ  )r`  r7  r_   rŠ  rL  r?  rI  rO   r@  )rÝ  rF  rÞ  r�   r_   rŠ  )r0  r   r©  r1  r_   rŠ  )r_   rŠ  )rb   rc   rd   r  r©  rs  rX  rY  r]  rZ  r[  rŒ  rc  r`  r´  r¸  r~   rÃ  rÝ  r1  rd  r¼   Ú__classcell__©rn  s   @rT   rŠ  rŠ    sp  ø„ ñð4 $(Ø ð(àð(ð :ð(ð ð	(ð
 !ð(ð õ(ó2*ð$Ø;ðà	"óó4ó8ó*	óð$ SWðØ*ðØ@Oðà	 óó0ó,ó,Bð (,Ø$ñ	
ð %ð
ð ð	
ð
 
ó
ó@"
ðN %)ð+Jð
 (,Ø$ñ+Jð "ð+Jð
 %ð+Jð ð+Jð 
ó+Jð\ :>ðØ%ðØ26ðà	 óð> AEð$Ø ð$Ø0=ð$à	 ó$óL÷$rW   rŠ  c                  ó¨   ‡ — e Zd ZdZ	 	 	 d	 	 	 	 	 	 	 	 	 dˆ fd„Zddd„Zdd„Zdd„Zdd„Zdd„Z	dd	d
œ	 	 	 	 	 dd„Z
	 	 dd	dœ	 	 	 	 	 dd„Zdd„Zˆ xZS )r�  z+A builder for full text search for LanceDB.Nc                ó”   •— t         ‰| �  |«       || _        d| _        |}d | _        || _        t        |t        «      r|g}|| _        y ©NF)	r`  r©  ra  Ú_phrase_queryrk  rm  r�   r    Ú_fts_columns)rQ   r{   r„   rx  rw  r¼   Ú_rn  s          €rT   r©  zLanceFtsQueryBuilder.__init__Ü  sP   ø€ ô 	‰Ñ˜ÔØˆŒØ"ˆÔð  ˆØˆŒØ'ˆÔÜ�k¤3Ô'Ø&˜-ˆKØ'ˆÕrW   c                ó   — || _         | S )a2  Set whether to use phrase query.

        Parameters
        ----------
        phrase_query: bool, default True
            If True, then an unquoted string query will be wrapped in quotes.

        Returns
        -------
        LanceFtsQueryBuilder
            The LanceFtsQueryBuilder object.
        ©r·  ©rQ   Úphrase_querys     rT   r½  z!LanceFtsQueryBuilder.phrase_queryð  ó   € ð *ˆÔØˆrW   c                ó  — | j                   }| j                  s|S t        |t        «      r*|j	                  d«      r|j                  d«      sd|› d�S |S t        |t        «      r|S t        dt        |«      j                  › �«      ‚)Nú"z5phrase_query() requires a string or PhraseQuery, got )
ra  r·  r�   r    Ú
startswithÚendswithrB  rà   r‰  rb   rê  s     rT   Ú_query_with_phrase_semanticsz1LanceFtsQueryBuilder._query_with_phrase_semantics 	  s…   € Ø—‘ˆØ×!Ò!ØˆLÜ�eœSÔ!Ø×#Ñ# CÔ(°·±¸sÔ0CØ˜5˜' �|Ð#ØˆLÜ�eœ[Ô)ØˆLÜðÜ˜“;×'Ñ'Ð(ð*ó
ð 	
rW   c                ó   — d| _         | S )a  
        Skip a flat search of unindexed data. This will improve
        search performance but search results will not include unindexed data.

        Returns
        -------
        LanceFtsQueryBuilder
            The LanceFtsQueryBuilder object.
        Tr®  rY   s    rT   r¼   z LanceFtsQueryBuilder.fast_search	  r¯  rW   c                óh  — t        | j                  | j                  | j                  | j                  | j
                  | j                  | j                  | j                  | j                  t        | j                  «       | j                  ¬«      | j                  | j                  | j                  ¬«      S )N©r„   r¦   )r¦   r‘   rº   rŠ   r¸   r‚   r   r€   rb  rˆ   r»   r¼   r‹   )r:   rœ  r�  rš  rž  rŸ  r   r¡  r¢  r£  rS  rÃ  r¸  r›  rm  r¨  rY   s    rT   r~   z$LanceFtsQueryBuilder.to_query_object	  s‹   € ÜØ—M‘MØ—;‘;Ø—+‘+Ø×'Ñ'Ø×)Ñ)Ø!×3Ñ3Ø—o‘oØ×+Ñ+Ø—M‘MÜ/Ø×7Ñ7Ó9À4×CTÑCTôð —<‘<Ø×)Ñ)Ø—^‘^ô
ð 	
rW   c                óT   — | j                   j                  | j                  «       «      S r”  r–  rY   s    rT   r´  z"LanceFtsQueryBuilder.output_schema/	  r˜  rW   rÑ   r¼  c               óp  — | j                  |«      }| j                  j                  «        | j                  «       }| j                  j	                  ||¬«      j                  «       }| j                  �1| j                  j                  | j                  |«      }t        |«       | j                  |||¬«      S ©Nr²  r   )r·  ry   Ú_ensure_no_legacy_fts_indexrë  r¡  rÙ   rk  Ú
rerank_ftsra  r!   rý  )rQ   r°  rR   rì   r„   Úresultss         rT   r¸  zLanceFtsQueryBuilder.to_arrow7	  sŸ   € ð ×3Ñ3°IÓ>ˆØ�‰×/Ñ/Ô1à×$Ñ$Ó&ˆØ—+‘+×,Ñ,¨U¸GÐ,ÓD×MÑMÓOˆØ�>‰>Ð%Ø—n‘n×/Ñ/°·±¸WÓEˆGÜ! 'Ô*Ø×.Ñ.Ø˜y°|ð /ó 
ð 	
rW   ©rR   c              ó   — t        d«      ‚)Nzto_batches on an FTS queryru   rÁ  s       rT   rÃ  zLanceFtsQueryBuilder.to_batchesI	  s   € ô "Ð">Ó?Ð?rW   c                óT   — || _         |j                  dk(  r| j                  d«       | S )a  Rerank the results using the specified reranker.

        Parameters
        ----------
        reranker: Reranker
            The reranker to use.

        Returns
        -------
        LanceFtsQueryBuilder
            The LanceQueryBuilder object.
        r¬   T)rk  r§  r¸   r/  s     rT   r1  zLanceFtsQueryBuilder.rerankS	  s*   € ð "ˆŒØ�>‰>˜UÒ"Ø×Ñ˜TÔ"ØˆrW   r9  )
r{   r:  r„   rZ  rx  r1  rw  r;  r¼   r�   rE  )r½  r�   r_   r�  )r_   rZ  )r_   r�  rI  rL  r?  r°  ©rÂ  r4  r°  r>  rR   r5   )r0  r   r_   r�  )rb   rc   rd   r  r©  r½  rÃ  r¼   r~   r´  r¸  rÃ  r1  r²  r³  s   @rT   r�  r�  Ù  sÊ   ø„ Ù5ð .2Ø7;Ø ð(àð(ð #ð(ð +ð	(ð
 5ð(ð õ(ô(ó 
óó
ó&Bð (,Ø$ñ	
ð %ð
ð ð	
ð
 
ó
ð* %)Ø'+ð	@ð %ñ@ð "ð@ð %ð	@ð ó@÷rW   r�  c                  ó`   — e Zd Zdddœ	 	 	 	 	 d
d„Zdd„Zdd„Z	 	 dddœ	 	 	 	 	 	 	 dd„Zdd	„Zy)r  NrÑ   r¼  c               óˆ   — | j                  |«      }| j                  | j                  |¬«      j                  «       ||¬«      S rÉ  rš  r›  s       rT   r¸  zLanceEmptyQueryBuilder.to_arrowg	  sI   € ð ×3Ñ3°IÓ>ˆØ×.Ñ.Ø�O‰O GˆOÓ,×5Ñ5Ó7ØØ%ð /ó 
ð 	
rW   c                óô   — t        | j                  | j                  | j                  | j                  | j
                  | j                  | j                  | j                  | j                  | j                  ¬«
      S )N)
r¦   r‘   rº   r¸   r‚   r   r€   rb  r»   r‹   )r:   rœ  r�  rš  rŸ  r   r¡  r¢  r£  r›  r¨  rY   s    rT   r~   z&LanceEmptyQueryBuilder.to_query_objectt	  s[   € ÜØ—M‘MØ—;‘;Ø—+‘+Ø×)Ñ)Ø!×3Ñ3Ø—o‘oØ×+Ñ+Ø—M‘MØ—<‘<Ø—^‘^ô
ð 	
rW   c                óX   — | j                  «       }| j                  j                  |«      S rO   )r~   ry   r—  rê  s     rT   r´  z$LanceEmptyQueryBuilder.output_schema‚	  s%   € Ø×$Ñ$Ó&ˆØ�{‰{×)Ñ)¨%Ó0Ð0rW   rÍ  c              ó¦   — | j                  |«      }| j                  «       }| j                  j                  |||¬«      }| j	                  |||«      S )Nr   )r·  rë  ry   r¡  r  )rQ   rÂ  r°  rR   rì   r„   rÛ   s          rT   rÃ  z!LanceEmptyQueryBuilder.to_batches†	  sY   € ð ×3Ñ3°IÓ>ˆØ×$Ñ$Ó&ˆØ—‘×+Ñ+Ø˜j°'ð ,ó 
ˆð ×$Ñ$ V¨Y¸ÓEÐErW   c                ó   — t        d«      ‚)a  Rerank the results using the specified reranker.

        Parameters
        ----------
        reranker: Reranker
            The reranker to use.

        Returns
        -------
        LanceEmptyQueryBuilder
            The LanceQueryBuilder object.
        zReranking is not yet supported.ru   r/  s     rT   r1  zLanceEmptyQueryBuilder.rerank•	  s   € ô "Ð"CÓDÐDrW   r?  rI  rL  r°  r@  )r0  r   r_   r  )rb   rc   rd   r¸  r~   r´  rÃ  r1  rP   rW   rT   r  r  f	  s‚   „ ð (,Ø$ñ	
ð %ð
ð ð	
ð
 
ó
ó
ó1ð %)Ø'+ð	Fð %ñFð "ðFð %ð	Fð ðFð 
óFôErW   r  c                  óê  ‡ — e Zd ZdZ	 	 	 d%	 	 	 	 	 	 	 d&ˆ fd„Zd'd„Zd(ˆ fd„Zd)d*d„Zd+d„Zddd	œ	 	 	 	 	 d,d
„Z	ddœ	 	 	 	 	 	 	 d-d„Z
	 	 	 	 	 	 	 	 d.d„Ze	 d/	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d0d„«       Z	 	 d'ddœ	 	 	 	 	 d1d„Zed)d2d„«       Zed3d4d„«       Z e«       df	 	 	 	 	 d5d„Zd6d„Zd7d„Zd8d„Zd9d„Z	 d'	 	 	 	 	 d:d„Zd;d„Zd<d„Z	 	 	 	 d=d„Zd>d„Zd?d„Zd@d„ZdAd „Zd3dBd!„Z	 dC	 	 	 dDd"„Z dEd#„Z!d$„ Z"ˆ xZ#S )Fr~  á  
    A query builder that performs hybrid vector and full text search.
    Results are combined and reranked based on the specified reranker.
    By default, the results are reranked using the RRFReranker, which
    uses reciprocal rank fusion score for reranking.

    To make the vector and fts results comparable, the scores are normalized.
    Instead of normalizing scores, the `normalize` parameter can be set to "rank"
    in the `rerank` method to convert the scores to ranks and then normalize them.
    Nc                ó  •— t         ‰| �  |«       || _        || _        || _        d | _        d | _        d | _        d | _        d | _	        d | _
        d | _        d | _        d | _        d | _        d | _        d | _        d| _        y r¶  )r`  r©  ra  rj  r¸  Ú_normrk  rc  rd  re  rf  ri  rb  r·  rg  rh  Ú
_pk_fusionÚ_caller_requested_row_id)rQ   r{   r„   rU  rw  rn  s        €rT   r©  z LanceHybridQueryBuilder.__init__±	  s‘   ø€ ô 	‰Ñ˜ÔØˆŒØ+ˆÔØ'ˆÔØˆŒ
ØˆŒØˆŒØ $ˆÔØ $ˆÔØ"ˆÔØ"ˆÔØ"ˆÔØ!ˆÔØ ˆÔØ ˆÔð ;?ˆŒð ).ˆÕ%rW   c                ó~  — |�|€|�t        d«      ‚|�|n|}t        |t        t        f«      r&t	        j
                  |t        j                  ¬«      }n³t        |t        j                  «      r |j                  t        j                  «      }nyt        |t        j                  t        j                  f«      r4t	        j
                  |j                  «       t        j                  ¬«      }nt        |t        «      st        d«      ‚|xs |}|€t        d«      ‚t        |t        t        f«      st        d«      ‚||fS )NzƒYou can either provide a string query in search() method or set `vector()` and `text()` explicitly for hybrid search. But not both.ry  z0Vector query must be either a string or a vectorz.Text query must be provided for hybrid search.z,Text query must be a string or FullTextQuery)rÆ   r�   r«   r©   r‚  rƒ  r„  r…  r†  rù   rú   r‡  rˆ  r    r   )rQ   r„   r‡   r,  Úvector_queryÚ
text_querys         rT   Ú_validate_queryz'LanceHybridQueryBuilder._validate_queryÎ	  s  € ØÐ &Ð"4¸Ð8HÜð óð ð "(Ð!3‘v¸ˆô �l¤T¬5 MÔ2ÜŸ8™8 L¼¿
¹
ÔC‰LÜ˜¤b§j¡jÔ1Ø'×.Ñ.¬r¯z©zÓ:‰LÜ˜¤r§x¡x´·±Ð&AÔBÜŸ8™8 L×$:Ñ$:Ó$<ÄBÇJÁJÔO‰LÜ˜L¬#Ô.ÜÐOÓPÐPà’]˜Uˆ
ØÐÜÐMÓNÐNÜ˜*¤s¬MÐ&:Ô;ÜÐKÓLÐLà˜ZÐ'Ð'rW   c                ó0   •— || _         t        ‰| �	  |«      S )u  Set whether to return row ids.

        Recorded separately from `_with_row_id`, which `rerank(return_score=
        "all")` also sets for its own use â€” on an RTE table only a caller who
        asked is refused, and the reranker still falls back to the primary key.
        )rÜ  r`  r¸   )rQ   r¸   rn  s     €rT   r¸   z#LanceHybridQueryBuilder.with_row_idê	  s   ø€ ð )4ˆÔ%Ü‰wÑ" ;Ó/Ð/rW   c                ó   — || _         | S )a8  Set whether to use phrase query.

        Parameters
        ----------
        phrase_query: bool, default True
            If True, then an unquoted string query will be wrapped in quotes.

        Returns
        -------
        LanceHybridQueryBuilder
            The LanceHybridQueryBuilder object.
        r»  r¼  s     rT   r½  z$LanceHybridQueryBuilder.phrase_queryô	  r¾  rW   c                ó   — t        d«      ‚)Nz3to_query_object not yet supported on a hybrid queryru   rY   s    rT   r~   z'LanceHybridQueryBuilder.to_query_object
  s   € Ü!Ð"WÓXÐXrW   rÑ   r¼  c               ó˜   ‡ ‡‡‡— ‰ j                  ‰«      Št        j                  ˆˆˆ ˆfd„‰ j                  ˆ fd„‰ j                  ¬«      S )Nc                 ó,   •— ‰j                  ‰‰ ‰¬«      S )N)r°  rR   rì   ©Ú_run_hybrid)rR   rì   rQ   r°  s   €€€€rT   ú<lambda>z2LanceHybridQueryBuilder.to_arrow.<locals>.<lambda>
  s   ø€ �D×$Ñ$Ø¨9À<ð %ó € rW   c                 ó    •— ‰ j                   d uS rO   ©rÛ  rY   s   €rT   rè  z2LanceHybridQueryBuilder.to_arrow.<locals>.<lambda>
  ó   ø€ ˜$Ÿ/™/°Ð5€ rW   ©ÚfusedÚcaller_requested_row_id)r·  r(   Úwith_pk_fallbackry   rÜ  r›  s   ```@rT   r¸  z LanceHybridQueryBuilder.to_arrow
  sB   û€ ð ×3Ñ3°IÓ>ˆä×+Ñ+öð �K‰KÛ5Ø$(×$AÑ$Aô
ð 	
rW   r²  c          
     óØ  — | j                  «        | j                  | j                  }}| j                  €"|j	                  d«      }|j	                  d«      }t        «       5 }|j                  |j                  |¬«      }|j                  |j                  |¬«      }|j                  «       }	|j                  «       }
d d d «       | j                  �| j                  j                  
	«      \  }
}	| j                  	
| j                  | j                  j                  | j                  | j                  xs t        d| j                   ¬«      }| j#                  |||¬«      S # 1 sw Y   Œ¥xY w)NTr²  ©Úfts_resultsÚvector_resultsÚnormÚ	fts_queryr0  rº   Úwith_row_idsr»   r   )Ú_create_query_buildersÚ
_fts_queryÚ_vector_queryrÛ  r¸   r   Úsubmitr¸  ÚresultÚstampÚ_combine_hybrid_resultsrÚ  ra  rk  rš  ÚDEFAULT_HYBRID_LIMITr›  Ú_finish_hybrid_results)rQ   r°  rR   rì   rõ  rÞ  ÚexecutorÚ
fts_futureÚvector_futurerò  ró  rÌ  s               rT   rç  z#LanceHybridQueryBuilder._run_hybrid
  sP  € ð 	×#Ñ#Ô%Ø"&§/¡/°4×3EÑ3E�<ˆ	à�?‰?Ð"Ø!×-Ñ-¨dÓ3ˆIØ'×3Ñ3°DÓ9ˆLÜÓ!ð 	4 XØ!Ÿ™¨×);Ñ);ÀW˜ÓMˆJØ$ŸO™O¨L×,AÑ,AÈ7˜OÓSˆMØ$×+Ñ+Ó-ˆKØ*×1Ñ1Ó3ˆN÷		4ð
 �?‰?Ð&Ø*.¯/©/×*?Ñ*?Ø ó+Ñ'ˆN˜Kð ×.Ñ.Ø#Ø)Ø—‘Ø—o‘o×,Ñ,Ø—^‘^Ø—+‘+Ò5Ô!5ØØ—<‘<ð /ó 	
ˆð ×*Ñ*Ø˜y°|ð +ó 
ð 	
÷)	4ð 	4ús   Á!AE Å E)c               óˆ  — | j                   �,| j                  | j                   j                  |«      ||«      S | j                  «       r| j                  |||«      S | j	                  «       r| j                  |||¬«      S d|j                  v r#| j                  |||«      j                  dg«      S | j                  |||«      S )Nr   rç   )rÛ  rö  Ústriprã  ræ  rý  rè   rê   )rQ   rÌ  rR   rì   s       rT   rÿ  z.LanceHybridQueryBuilder._finish_hybrid_results=
  sÓ   € ð �?‰?Ð&Ø×.Ñ.Ø—‘×%Ñ% gÓ.°	¸<óð ð ×&Ñ&Ô(Ø×.Ñ.¨w¸	À<ÓPÐPØ×)Ñ)Ô+Ø×2Ñ2Ø 9¸<ð 3ó ð ð �w×+Ñ+Ñ+à×.Ñ.¨w¸	À<ÓP×UÑUØ�
óð ð ×*Ñ*¨7°I¸|ÓLÐLrW   c                ó  — |j                   dk(  ró| j                   dk(  rät        j                  |j                  | j                  g«      }t        j                  |j
                  D �	ci c]3  }	|	t        j                  g |j                  |	«      j                  ¬«      “Œ5 c}	«      }
|
j                  dt        j                  g t        j                  «       ¬«      «      }
|s d|
j                  v r|
j                  dg«      }
|
S d }d }d }d }|j                   dkD  rœ|j                  j                  d«      }|j                  |«      }|j                  d«      }|dk(  rt        j!                  |d«      }|j#                  ||j                  |«      t        j%                  |j                  |«      «      «      }| j                   dkD  rœ| j                  j                  d«      }| j                  |«      }| j                  d«      }|dk(  rt        j!                  | d«      } | j#                  || j                  |«      t        j%                  | j                  |«      «      «      } |j'                  ||| «      }t)        |«       d|j                  v ra|�_t+        j,                  |d   |d¬	«      }t+        j.                  ||«      }|j                  j                  d«      }|j#                  |d|«      }d|j                  v ra|�_t+        j,                  |d   |d¬	«      }t+        j.                  ||«      }|j                  j                  d«      }|j#                  |d|«      }|j1                  |xs d|¬
«      }|s|j                  dg«      }|S c c}	w )Nr   ©r‰  Ú_relevance_scorerç   Ú	_distanceÚrankÚ_scoreT)Ú
skip_nulls)r»   Úlength)Únum_rowsrù   Úunify_schemasrM   r{   Únamesrƒ  rÖ   r‰  Úappend_columnr„  rè   rê   Úindexr£   r~  Ú_rankÚ
set_columnÚ_normalize_scoresÚrerank_hybridr!   ÚpcÚindex_inÚtakeÚslice)rò  ró  rô  rõ  r0  rº   rö  r»   Úcombined_schemaÚcolÚemptyÚoriginal_distancesÚoriginal_scoresÚoriginal_distance_row_idsÚoriginal_score_row_idsÚ
distance_iÚscore_irÌ  Úindicess                      rT   rý  z/LanceHybridQueryBuilder._combine_hybrid_resultsU
  s_  € ð ×"Ñ" aÒ'¨K×,@Ñ,@ÀAÒ,Eä ×.Ñ.Ø×&Ñ&¨×(:Ñ(:Ð;óˆOô —H‘Hð  /×4Ñ4öàð œŸ™ "¨?×+@Ñ+@ÀÓ+E×+JÑ+JÔKÑKòóˆEð ×'Ñ'Ø"¤B§H¡H¨R´b·j±j³lÔ$CóˆEñ   H°×0BÑ0BÑ$BØŸ
™
 H :Ó.�ØˆLà!ÐØˆØ$(Ð!Ø!%Ðð ×"Ñ" QÒ&Ø'×4Ñ4×:Ñ:¸;ÓGˆJØ!/×!6Ñ!6°zÓ!BÐØ(6×(=Ñ(=¸hÓ(GÐ%Ø�vŠ~Ü!8×!>Ñ!>Ø" Kó"�ð ,×6Ñ6ØØ×$Ñ$ ZÓ0Ü'×9Ñ9Ø"×)Ñ)¨*Ó5óóˆNð ×Ñ !Ò#Ø!×.Ñ.×4Ñ4°XÓ>ˆGØ)×0Ñ0°Ó9ˆOØ%0×%7Ñ%7¸Ó%AÐ"Ø�vŠ~Ü5×;Ñ;¸KÈÓR�Ø%×0Ñ0ØØ×!Ñ! 'Ó*Ü'×9Ñ9¸+×:LÑ:LÈWÓ:UÓVóˆKð ×(Ñ(¨°NÀKÓPˆä˜gÔ&à˜'×.Ñ.Ñ.Ð3EÐ3Qä—k‘kØ˜Ñ!Ð#<ÈôˆGô "$§¡Ð);¸WÓ!EÐØ ×-Ñ-×3Ñ3°KÓ@ˆJØ×(Ñ(¨°[ÐBTÓUˆGà�w×+Ñ+Ñ+°Ð0Kä—k‘kØ˜Ñ!Ð#9ÀdôˆGô !Ÿg™g o°wÓ?ˆOØ×*Ñ*×0Ñ0°Ó:ˆGØ×(Ñ(¨°(¸OÓLˆGà—-‘- v¢{°¸5�-ÓAˆáØ—l‘l H :Ó.ˆGàˆùò]s   Á'8N
rÍ  c              ó   — t        d«      ‚)Nz.to_batches not yet supported on a hybrid queryru   rÁ  s       rT   rÃ  z"LanceHybridQueryBuilder.to_batches¸
  s   € ô "Ð"RÓSÐSrW   c           	     ó¾  — t        | «      dk(  r| S | j                  |«      j                  «       }t        j                  |«      }|s|d d d…   }t        j
                  |«      }t        j                  t        |«      «      dz   ||<   | j                  j                  |«      }| j                  ||t        j                  |t        j                  «       ¬«      «      } | S )Nr   éÿÿÿÿr   r  )rª   r£   Úto_numpyr‚  ÚargsortÚ
empty_likeÚarangerè   r  r  rù   rƒ  r„  )rÌ  r£   r  ÚscoresÚsort_indicesÚranksÚ
_score_idxs          rT   r  zLanceHybridQueryBuilder._rankÂ
  s¸   € äˆw‹<˜1ÒØˆNà—‘ Ó'×0Ñ0Ó2ˆÜ—z‘z &Ó)ˆÙØ'©¨"¨Ñ-ˆLÜ—‘˜lÓ+ˆÜ Ÿi™i¬¨F«Ó4°qÑ8ˆˆlÑà×)Ñ)×/Ñ/°Ó7ˆ
Ø×$Ñ$Ø˜¤§¡¨´R·Z±Z³\Ô Bó
ˆð ˆrW   c                ó,  — t        | «      dk(  r| S t        j                  | «      j                  «       \  }}t        j                  ||«      }t        j
                  |t        j                  d«      «      j                  «       s+t        j                  t        j                  | |«      |«      } nMt        j
                  |t        j                  d«      «      j                  «       st        j                  | |«      } |rt        j                  d| «      } | S )Nr   g        r   )
rª   r  Úmin_maxÚvaluesÚsubtractÚequalrù   ÚscalarÚas_pyÚdivide)r+  ÚinvertÚminÚmaxÚrngs        rT   r  z)LanceHybridQueryBuilder._normalize_scoresÔ
  s¿   € äˆv‹;˜!ÒØˆMä—:‘:˜fÓ%×,Ñ,Ó.‰ˆˆSÜ�k‰k˜#˜sÓ#ˆä�x‰x˜œRŸY™Y s›^Ó,×2Ñ2Ô4Ü—Y‘YœrŸ{™{¨6°3Ó7¸Ó=‰FÜ—‘˜#œrŸy™y¨›~Ó.×4Ñ4Ô6ä—[‘[ ¨Ó-ˆFáÜ—[‘[  FÓ+ˆFàˆrW   r§  c                ó¦   — |dvrt        d«      ‚|rt        |t        «      st        d«      ‚|| _        || _        |j
                  dk(  rd| _        | S )a™  
        Rerank the hybrid search results using the specified reranker. The reranker
        must be an instance of Reranker class.

        Parameters
        ----------
        reranker: Reranker, default RRFReranker()
            The reranker to use. Must be an instance of Reranker class.
        normalize: str, default "score"
            The method to normalize the scores. Can be "rank" or "score". If "rank",
            the scores are converted to ranks and then normalized. If "score", the
            scores are normalized directly.
        Returns
        -------
        LanceHybridQueryBuilder
            The LanceHybridQueryBuilder object.
        ©r	  r§  ú$normalize must be 'rank' or 'score'.ú/reranker must be an instance of Reranker class.r¬   T)rÆ   r�   r   rÚ  rk  r§  rŸ  ©rQ   r0  Ú	normalizes      rT   r1  zLanceHybridQueryBuilder.rerankç
  sZ   € ð, Ð-Ñ-ÜÐCÓDÐDÙœJ x´Ô:ÜÐNÓOÐOàˆŒ
Ø!ˆŒØ�>‰>˜UÒ"ð !%ˆDÔàˆrW   c                ó4   — |dk  rt        d«      ‚|| _        | S )aZ  
        Set the number of probes to use for vector search.

        Higher values will yield better recall (more likely to find vectors if
        they exist) at the expense of latency.

        The value is retained as `nprobes` until Lance sets both probe bounds to it.
        Explicit minimum or maximum settings can override their respective bounds.

        Parameters
        ----------
        nprobes: int
            The number of probes to use. Must be greater than 0.

        Returns
        -------
        LanceHybridQueryBuilder
            The LanceHybridQueryBuilder object.
        r   r|  r}  r~  s     rT   rY  zLanceHybridQueryBuilder.nprobes  s#   € ð( �aŠ<ÜÐLÓMÐMØˆŒØˆrW   c                ó   — || _         | S )a¿  Set the initial IVF search effort to a finite value in [0, 1].

        None (the default) uses Auto, internally 0.5. Zero starts at the caller
        minimum; one searches all partitions within the caller maximum. Later
        probing may continue when too few candidates are found. Any explicit
        effort, including 0.5, overrides nprobes in either call order. Explicit
        minimum and maximum bounds still apply. This is not a recall guarantee
        and does not change refinement or HNSW ef. RTE LSM queries do not
        yet support this option.

        Examples
        --------
        >>> import lancedb
        >>> db = lancedb.connect("memory://")
        >>> table = db.create_table(
        ...     "effort_hybrid", [{"vector": [0.1, 0.2], "text": "dog"}]
        ... )
        >>> query = (
        ...     table.search(query_type="hybrid").vector([0.1, 0.2])
        ...     .text("dog").search_effort(0.75)
        ... )
        r€  r�  s     rT   r]  z%LanceHybridQueryBuilder.search_effort%  s   € ð. ,ˆÔØˆrW   c                ó   — || _         | S )zZSet the minimum number of probes to use.

        See `nprobes` for more details.
        rƒ  r„  s     rT   rZ  z'LanceHybridQueryBuilder.minimum_nprobes?  ó   € ð
 !0ˆÔØˆrW   c                ó   — || _         | S )zZSet the maximum number of probes to use.

        See `nprobes` for more details.
        r‡  rˆ  s     rT   r[  z'LanceHybridQueryBuilder.maximum_nprobesG  rD  rW   c                ó"   — || _         || _        | S )aÜ  
        Set the distance range to use.

        Only rows with distances within range [lower_bound, upper_bound)
        will be returned.

        Parameters
        ----------
        lower_bound: Optional[float]
            The lower bound of the distance range.
        upper_bound: Optional[float]
            The upper bound of the distance range.

        Returns
        -------
        LanceHybridQueryBuilder
            The LanceHybridQueryBuilder object.
        rŠ  r‹  s      rT   rŒ  z&LanceHybridQueryBuilder.distance_rangeO  s   € ð* (ˆÔØ'ˆÔØˆrW   c                ó   — || _         | S )a  
        Set the number of candidates to consider during search.

        Higher values will yield better recall (more likely to find vectors if
        they exist) at the expense of latency.

        This only applies to the HNSW-related index.
        The default value is 1.5 * limit.

        Parameters
        ----------
        ef: int
            The number of candidates to consider during search.

        Returns
        -------
        LanceHybridQueryBuilder
            The LanceHybridQueryBuilder object.
        rŽ  r�  s     rT   rc  zLanceHybridQueryBuilder.efh  s   € ð( ˆŒØˆrW   c                ó$   — | j                  |«      S rp  rq  rr  s     rT   rs  zLanceHybridQueryBuilder.metric  rt  rW   c                ó0   — |j                  «       | _        | S rv  rw  ry  s     rT   rX  z%LanceHybridQueryBuilder.distance_type‘  rz  rW   c                ó   — || _         | S )aL  
        Refine the vector search results by reading extra elements and
        re-ranking them in memory.

        Parameters
        ----------
        refine_factor: int
            The refine factor to use.

        Returns
        -------
        LanceHybridQueryBuilder
            The LanceHybridQueryBuilder object.
        r‘  r’  s     rT   r`  z%LanceHybridQueryBuilder.refine_factor«  s   € ð ,ˆÔØˆrW   c                ó   — || _         | S )a*  Set the vector to search for.

        Parameters
        ----------
        vector: list, tuple, np.ndarray, pa.Array, or pa.ChunkedArray
            The vector to search for.

        Returns
        -------
        LanceHybridQueryBuilder
            The LanceHybridQueryBuilder object.
        )r¤  r)  s     rT   r‡   zLanceHybridQueryBuilder.vector½  s   € ð ˆŒØˆrW   c                ó   — || _         | S rO   )r¥  r+  s     rT   r,  zLanceHybridQueryBuilder.textÍ  s   € ØˆŒ
ØˆrW   c                ó   — d| _         | S )a<  
        If this is called then any vector index is skipped

        An exhaustive (flat) search will be performed.  The query vector will
        be compared to every vector in the table.  At high scales this can be
        expensive.  However, this is often still useful.  For example, skipping
        the vector index can give you ground truth results which you can use to
        calculate your recall to select an appropriate value for nprobes.

        Returns
        -------
        LanceHybridQueryBuilder
            The LanceHybridQueryBuilder object.
        Tr«  rY   s    rT   rd  z+LanceHybridQueryBuilder.bypass_vector_indexÑ  r¬  rW   c                óè  — | j                  «        | j                  rt        | j                  «      nd}| j                  j	                  | j
                  j                  «       |¬«      }| j                  j	                  | j                  j                  «       |¬«      }dj                  d„ |j                  «       D «       «      }dj                  d„ |j                  «       D «       «      }|› d|› d|› �S )r  zNo rerankerr  ú
c              3  ó&   K  — | ]	  }d |z   –— Œ y­w©z  NrP   ©r¢   Úlines     rT   r¤   z7LanceHybridQueryBuilder.explain_plan.<locals>.<genexpr>	  ó   è ø€ Ò#U°D D¨4¥KÑ#Uùó   ‚c              3  ó&   K  — | ]	  }d |z   –— Œ y­wrQ  rP   rR  s     rT   r¤   z7LanceHybridQueryBuilder.explain_plan.<locals>.<genexpr>
  ó   è ø€ Ò O° ¨¥Ñ OùrU  ú
  )
r÷  rk  r    ry   r  rù  r~   rø  rÉ   Ú
splitlines)rQ   r  Úreranker_labelÚvector_planÚfts_planÚindented_vectorÚindented_ftss          rT   r  z$LanceHybridQueryBuilder.explain_planã  sÕ   € ð8 	×#Ñ#Ô%à04·²œ˜TŸ^™^Ô,ÀMˆØ—k‘k×/Ñ/Ø×Ñ×.Ñ.Ó0¸'ð 0ó 
ˆð —;‘;×,Ñ,Ø�O‰O×+Ñ+Ó-°wð -ó 
ˆð Ÿ)™)Ñ#U¸K×<RÑ<RÓ<TÔ#UÓUˆØ—y‘yÑ O¸×9LÑ9LÓ9NÔ OÓOˆØ Ð!  oÐ%6°d¸<¸.ÐIÐIrW   c                ó|  — | j                  «        dg}|j                  | j                  j                  | j                  j                  «       |¬«      «       |j                  d«       |j                  | j                  j                  | j                  j                  «       |¬«      «       dj                  |«      S )áV  Execute the query and display with runtime metrics.

        Parameters
        ----------
        distributed_metrics : Literal["aggregate", "per_worker", "full"]
            Defaults to "aggregate".
            How distributed worker metrics are displayed for remote query plans.

        Returns
        -------
        plan : str
        zVector Search Plan:r#  zFTS Search Plan:rO  )r÷  Úappendry   r%  rù  r~   rø  rÉ   )rQ   r$  rÌ  s      rT   r'  z$LanceHybridQueryBuilder.analyze_plan  s¦   € ð 	×#Ñ#Ô%à(Ð)ˆØ�‰Ø�K‰K×%Ñ%Ø×"Ñ"×2Ñ2Ó4Ø$7ð &ó ô	
ð 	�‰Ð)Ô*Ø�‰Ø�K‰K×%Ñ%Ø—‘×/Ñ/Ó1Ø$7ð &ó ô	
ð �y‰y˜Ó!Ð!rW   c                óV   — | j                  «        | j                  j                  «       S rO   )r÷  rù  r´  rY   s    rT   rð  z+LanceHybridQueryBuilder._blob_output_schema.  s#   € Ø×#Ñ#Ô%Ø×!Ñ!×/Ñ/Ó1Ð1rW   c                ó6
  — | j                  | j                  | j                  | j                  «      \  }}t	        | j
                  || j                  ¬«      | _        | j                  | j
                  || j                  «      }t        | j
                  || j                  «      | _        | j                  xs t        }|| j                  xs dz   }| j                  j                  |«       | j                  j                  |«       d| _        | j"                  }t%        j&                  | j
                  | j(                  «      rjt$        j*                  j-                  | j
                  j.                  | j"                  | j0                  ¬«      | _        | j                   j3                  |«      }|r6| j                  j5                  |«       | j                  j5                  |«       t7        | j8                  t:        «      s| j8                  rb| j                  j=                  | j8                  | j>                   «       | j                  j=                  | j8                  | j>                   «       | j@                  rB| j                   €6| j                  jC                  d«       | j                  jC                  d«       | j(                  �J| j                  jE                  | j(                  «       | j                  jE                  | j(                  «       | jF                  r| j                  jI                  d«       | jJ                  r%| j                  jM                  | jJ                  «       | jN                  �%| j                  jQ                  | jN                  «       | jR                  �%| j                  jU                  | jR                  «       | jV                  �%| j                  jY                  | jV                  «       | jZ                  �%| j                  j]                  | jZ                  «       | j^                  r%| j                  ja                  | j^                  «       | jb                  r%| j                  je                  | jb                  «       | jf                  r| j                  ji                  «        | jj                  €| jl                  �1| j                  jo                  | jj                  | jl                  ¬«       | jp                  €ts        «       | _8        yy)z7Set up and configure the vector and FTS query builders.rv  r   N©rî  T)r^  r_  ):rà  ra  r¤  r¥  r�  ry   r¸  rø  r�  rj  rŠ  rù  rš  rþ  r›  rº   rÛ  rœ  r(   Úpk_fusion_learnedr£  ÚPkFusionÚ	for_queryrM   rÜ  Úinjectr´   r�   r�  r   rÝ  rž  rŸ  r¸   rb  r·  r½  rb  rs  rc  rY  rf  r]  rd  rZ  re  r[  ri  r`  r¦  rc  r§  rd  rg  rh  rŒ  rk  r    )rQ   rÞ  rõ  rº   Úsub_query_limitr¦   s         rT   r÷  z.LanceHybridQueryBuilder._create_query_builders2  sË  € à"&×"6Ñ"6Ø�K‰K˜Ÿ™ t§z¡zó#
Ñˆ�iô /Ø�K‰K˜°×0AÑ0Aô
ˆŒð ×,Ñ,Ø�K‰K˜ t×':Ñ':ó
ˆô 5Ø�K‰K˜ t×':Ñ':ó
ˆÔð —‘Ò3Ô3ˆØ 4§<¡<Ò#4°1Ñ5ˆØ×Ñ× Ñ  Ô1Ø�‰×Ñ˜oÔ.àˆŒØ—-‘-ˆÜ×(Ñ(¨¯©°d·m±mÔDÜ)×2Ñ2×<Ñ<Ø—‘×"Ñ"Ø—‘Ø(,×(EÑ(Eð =ó ˆDŒOð
 —o‘o×,Ñ,¨WÓ5ˆGÙØ×Ñ×%Ñ% gÔ.Ø�O‰O×"Ñ" 7Ô+ô �d—k‘k¤4Ô(¨D¯KªKØ×Ñ×$Ñ$ T§[¡[°d×6FÑ6FÐ2FÔGØ�O‰O×!Ñ! $§+¡+°4×3CÑ3CÐ/CÔDà×Ò §¡Ð!8Ø×Ñ×*Ñ*¨4Ô0Ø�O‰O×'Ñ'¨Ô-Ø�=‰=Ð$Ø×Ñ×&Ñ& t§}¡}Ô5Ø�O‰O×#Ñ# D§M¡MÔ2Ø×ÒØ�O‰O×(Ñ(¨Ô.Ø×ÒØ×Ñ×%Ñ% d×&9Ñ&9Ô:Ø�=‰=Ð$Ø×Ñ×&Ñ& t§}¡}Ô5Ø×ÑÐ*Ø×Ñ×,Ñ,¨T×-@Ñ-@ÔAØ× Ñ Ð,Ø×Ñ×.Ñ.¨t×/DÑ/DÔEØ× Ñ Ð,Ø×Ñ×.Ñ.¨t×/DÑ/DÔEØ×ÒØ×Ñ×,Ñ,¨T×-@Ñ-@ÔAØ�8Š8Ø×Ñ×!Ñ! $§(¡(Ô+Ø×$Ò$Ø×Ñ×2Ñ2Ô4Ø×ÑÐ(¨D×,=Ñ,=Ð,IØ×Ñ×-Ñ-Ø ×-Ñ-¸4×;LÑ;Lð .ô ð �>‰>Ð!Ü(›]ˆD�Nð "rW   r9  )r{   r:  r„   z#Optional[Union[str, FullTextQuery]]rU  r1  rw  r;  r°  rG  rE  )r½  r�   r_   r~  rI  r?  )r°  r>  rR   r5   rì   rK  r_   ra   )rÌ  ra   rR   r5   rì   rK  r_   ra   rO   )rò  ra   ró  ra   rô  r    rõ  r    rº   r7  rö  r�   r»   r4  r_   ra   rÐ  )rÌ  ra   r£   r    r  r�   rS  )r+  úpa.Arrayr_   rj  )r0  r   r@  r    r_   r~  )rY  r7  r_   r~  )r]  r\  r_   r~  )rZ  r7  r_   r~  )r[  r7  r_   r~  )r^  r\  r_  r\  r_   r~  )rc  r7  r_   r~  )rs  r±  r_   r~  )rX  r±  r_   z'LanceHybridQueryBuilder')r`  r7  r_   r~  )r‡   rY  r_   r~  )r,  rZ  r_   r~  )r_   r~  rT  rV  rW  rL  )$rb   rc   rd   r  r©  rà  r¸   r½  r~   r¸  rç  rÿ  Ústaticmethodrý  rÃ  r  r  r    r1  rY  r]  rZ  r[  rŒ  rc  rs  rX  r`  r‡   r,  rd  r  r'  rð  r÷  r²  r³  s   @rT   r~  r~  ¥	  sy  ø„ ñ	ð 6:Ø'+Ø7;ð.àð.ð 3ð.ð %ð	.ð
 5õ.ó:(õ80ôó Yð (,Ø$ñ	
ð %ð
ð ð	
ð
 
ó
ð( (,ñ#
ð %ð#
ð ð	#
ð
 %ð#
ð 
ó#
ðJMàðMð ð	Mð
 %ðMð 
óMð0 ð !%ð`Øð`à ð`ð ð`ð ð	`ð ð`ð ð`ð ð`ð 
ò`ó ð`ðJ %)Ø'+ð	Tð %ñTð "ðTð %ð	Tð óTð óó ðð" óó ðñ( )›]Ø ð#àð#ð ð#ð 
!ó	#óJó2ó4óð SWðØ*ðØ@Oðà	 óó2ó.*ð$Ø;ðà	"óó4ó$ó óô$(JðV DOð"Ø#@ð"à	ó"óB2öI+rW   r~  c                  ó¬  — e Zd ZdZ	 d"	 	 	 d#d„Zd$d„Zd%d„Zd%d„Zd&d„Zd'd„Z	d(d	„Z
d)d
„Zd*d+d„Zd,d„Zd-d„Zddddœ	 	 	 	 	 	 	 d.d„Zdddœ	 	 	 	 	 d/d„Zd0d„Zd1d„Zd0d„Z	 	 	 	 	 	 	 	 d2d„Z	 d"ddœ	 	 	 	 	 d3d„Z	 d"ddœ	 	 	 	 	 d4d„Z	 	 d5ddœ	 	 	 	 	 	 	 d6d„Z	 	 	 	 	 	 	 	 d6d„Z	 d"	 	 	 	 	 d7d„Z	 d"	 	 	 d8d„Zddœ	 	 	 	 	 d9d„Zd:d;d „Z	 d<	 	 	 d=d!„Zy)>ÚAsyncQueryBasezL
    Base class for all async queries (take, scan, vector, fts, hybrid)
    Nc                ót   — || _         || _        d| _        d| _        d| _        d| _        d| _        d| _        y)zÐ
        Construct an AsyncQueryBase

        This method is not intended to be called directly.  Instead, use the
        [AsyncTable.query][lancedb.table.AsyncTable.query] method to create a query.
        NFrP   )ro   ry   r   r¡  r¢  rŸ  Ú_blob_auto_row_idÚ_blob_paths)rQ   Úinnerr{   s      rT   r©  zAsyncQueryBase.__init__ƒ  sA   € ð ˆŒØˆŒØ!%ˆÔØˆŒØ!ˆÔØ ˆÔØ!&ˆÔØ,.ˆÕrW   c                óð   — t         j                  | j                  j                  «       «      }| j	                  «       |_        | j                  |_        | j                  |_	        | j                  |_        |S )zº
        Convert the query into a query object

        This is currently experimental but can be useful as the query object is pure
        python and more easily serializable.
        )r:   rk  ro   Úto_query_requestrã  r¸   r   r‚   r¡  r   r¢  r€   rê  s     rT   r~   zAsyncQueryBase.to_query_object—  s^   € ô × Ñ  §¡×!=Ñ!=Ó!?Ó@ˆØ ×7Ñ7Ó9ˆÔØ!%×!7Ñ!7ˆÔØŸ/™/ˆŒØ!×/Ñ/ˆÔØˆrW   c                ó   — | j                   du S râ  rà  rY   s    rT   rã  z%AsyncQueryBase._user_requested_row_id¥  rä  rW   c                ó   — | j                   S rO   )ro  rY   s    rT   ræ  z(AsyncQueryBase._blob_auto_row_id_enabled¨  s   € Ø×%Ñ%Ð%rW   c                ól   — t        || j                  «       | j                  «       | j                  ¬«      S )Nrø  )r.   rã  ræ  rp  )rQ   rã   s     rT   rý  z)AsyncQueryBase._finalize_blob_query_table«  s3   € Ü(ØØ"&×"=Ñ"=Ó"?Ø!×;Ñ;Ó=Ø×'Ñ'ô	
ð 	
rW   c              ƒ  óº  K  — | j                   €d| _        d| _        y | j                  j	                  «       }| j                   j                  «       ƒ d {  –—† }t        |«      }t        ||| j                  ¬«      | _        | j                  sd| _        y t        t        ||«      j                  «       «      | _        | j                  j                  «        y 7 Œƒ­w)NFrP   r·   )ry   ro  rp  ro   rs  rM   r¶   r,   rŸ  r©   r-   rû  r¸   )rQ   rµ   rM   r°   s       rT   Ú_maybe_add_blob_row_idz%AsyncQueryBase._maybe_add_blob_row_id³  s¹   è ø€ Ø�;‰;ÐØ%*ˆDÔ"Ø!ˆDÔØà�k‰k×*Ñ*Ó,ˆØ—{‘{×)Ñ)Ó+×+ˆÜ.¨sÓ3ˆ
Ü!:ØØØ×)Ñ)ô"
ˆÔð
 ×%Ò%Ø!ˆDÔØÜ Ô!;¸FÀJÓ!O×!TÑ!TÓ!VÓWˆÔØ�‰×ÑÕ!ð ,ús   ‚ACÁCÁBCc                ó  — t        |t        «      r/t        d„ |D «       «      r| j                  j	                  |«       | S t        |t
        «      �r t        d„ |D «       «      �rt        d„ |j                  «       D «       «      rWddlm	} |j                  «       D ��cg c]  \  }}| ||«      j                  f‘Œ }}}| j                  j                  |«       | S t        d„ |j                  «       D «       «      r4| j                  j                  t        |j                  «       «      «       | S t        dt        |j                  «       D ��ci c]  \  }}|t        |«      “Œ c}}«      z   «      ‚t        d«      ‚c c}}w c c}}w )	á`  
        Return only the specified columns.

        By default a query will return all columns from the table.  However, this can
        have a very significant impact on latency.  LanceDb stores data in a columnar
        fashion.  This
        means we can finely tune our I/O to select exactly the columns we need.

        As a best practice you should always limit queries to the columns that you need.
        If you pass in a list of column names then only those columns will be
        returned.

        You can also use this method to create new "dynamic" columns based on your
        existing columns. For example, you may not care about "a" or "b" but instead
        simply want "a + b".  This is often seen in the SELECT clause of an SQL query
        (e.g. `SELECT a+b FROM my_table`).

        To create dynamic columns you can pass in a dict[str, str].  A column will be
        returned for each entry in the map.  The key provides the name of the column.
        The value is an SQL string used to specify how the column is calculated.

        For example, an SQL query might state `SELECT a + b AS combined, c`.  The
        equivalent input to this method would be `{"combined": "a + b", "c": "c"}`.

        Columns will always be returned in the order given, even if that order is
        different than the order used when adding the data.
        c              3  ó<   K  — | ]  }t        |t        «      –— Œ y ­wrO   rŸ   )r¢   Úcs     rT   r¤   z(AsyncQueryBase.select.<locals>.<genexpr>ã  s   è ø€ Ò,QÀA¬Z¸¼3×-?Ñ,Qùr¥   c              3  ó<   K  — | ]  }t        |t        «      –— Œ y ­wrO   rŸ   )r¢   Úks     rT   r¤   z(AsyncQueryBase.select.<locals>.<genexpr>å  s   è ø€ Ò.SÀa¬z¸!¼S×/AÑ.Sùr¥   c              3  ó<   K  — | ]  }t        |t        «      –— Œ y ­wrO   )r�   r   ©r¢   rž  s     rT   r¤   z(AsyncQueryBase.select.<locals>.<genexpr>æ  s   è ø€ ÒA¨1”:˜a¤×&ÑAùr¥   r   )Ú_coercec              3  ó<   K  — | ]  }t        |t        «      –— Œ y ­wrO   rŸ   r€  s     rT   r¤   z(AsyncQueryBase.select.<locals>.<genexpr>ì  s   è ø€ ÒB¨A”Z ¤3×'ÑBùr¥   z%dict values must be str or Expr, got z0columns must be a list of column names or a dict)r�   r«   r¬   ro   Úselect_columnsrØ  Úanyr1  r¯   r�  r­   Úselect_exprr´   rà   r    r‰  )rQ   r¦   r�  r~  rž  Úpairss         rT   r´   zAsyncQueryBase.selectÇ  s<  € ô8 �gœtÔ$¬Ñ,QÈÔ,QÔ)QØ�K‰K×&Ñ& wÔ/ð" ˆô! ˜¤Õ&¬3Ñ.SÈ7Ô.SÕ+SÜÑA°·±Ó0@ÔAÔAå)à<C¿M¹M»O×L±D°A°q˜!™W Q›Z×.Ñ.Ò/ÐL�ÑLØ—‘×'Ñ'¨Ô.ð ˆô ÑB°·±Ó1AÔBÔBØ—‘×"Ñ"¤4¨¯©«Ó#8Ô9ð ˆô  Ø;Ü°'·-±-³/×B©$¨!¨Q˜1œd 1›g™:ÓBÓCñDóð ô
 ÐNÓOÐOùó Mùó Cs   ÂE<ÅFc                óH   — d| _         | j                  j                  «        | S )ú;
        Include the _rowid column in the results.
        T)rŸ  ro   r¸   rY   s    rT   r¸   zAsyncQueryBase.with_row_id÷  s!   € ð !ˆÔØ�‰×ÑÔ!ØˆrW   c                ó   — || _         | S ©zT
        Include the _rowaddr column in scanner-backed plain query results.
        r  r  s     rT   r‚   zAsyncQueryBase.with_row_addressÿ  s   € ð "2ˆÔØˆrW   c                ó   — || _         | S ©z[
        Restrict scanner-backed plain query results to the given Lance fragments.
        r  r  s     rT   r  zAsyncQueryBase.with_fragments  s   € ð $ˆŒØˆrW   c                ó   — || _         | S ©z^
        Restrict scanner-backed plain query results to the given Lance fragment ids.
        r  r  s     rT   r€   zAsyncQueryBase.fragment_ids  s   € ð *ˆÔØˆrW   rÑ   ©Úmax_batch_lengthr°  rR   c             ƒ  ón  ‡ ‡‡‡‡K  — ‰ j                  ‰«      ƒ d{  –—† Š‰ j                  ||¬«      ƒ d{  –—† Š‰dk(  r‰S dˆˆˆ fd„Š ‰t        j                  j	                  g ‰j
                  ¬«      «      ƒ d{  –—† j
                  }ˆˆfd„}t        j                  | |«       «      S 7 Œ’7 Œy7 Œ3­w)aß  
        Execute the query and return the results as an Apache Arrow RecordBatchReader.

        Parameters
        ----------

        max_batch_length: Optional[int]
            The maximum number of selected records in a single RecordBatch object.
            If not specified, a default batch length is used.
            It is possible for batches to be smaller than the provided length if the
            underlying data is stored in smaller chunks.
        timeout: Optional[timedelta]
            The maximum time to wait for the query to complete.
            If not specified, no timeout is applied. If the query does not
            complete within the specified time, an error will be raised.
        blob_mode: str, default "lazy"
            ``"lazy"`` keeps blob descriptors and auto row ids for manual fetches.
            ``"descriptions"`` omits auto row ids. ``"bytes"`` fetches blob v2
            payloads one batch at a time, without requiring pylance. Bytes mode
            has the same restrictions as :meth:`to_arrow`.

        Examples
        --------
        Use ``async for batch in await query.to_batches(blob_mode="bytes")``
        to stream blob payloads and convert each batch with ``batch.to_pandas()``.
        N©r�  r°  rÑ   c              “  óÌ   •K  — ‰j                  | «      } ‰j                  | ‰‰«      ƒ d {  –—† } ‰j                  «       s d| j                  v r| j	                  dg«      } | S 7 Œ6­w)Nrç   )rý  rö  rã  rè   ré   r  s    €€€rT   r  z*AsyncQueryBase.to_batches.<locals>.convert<  sd   øè ø€ Ø×1Ñ1°#Ó6ˆCØ×3Ñ3°C¸ÀLÓQ×QˆCØ×.Ñ.Ô0°XÀ×AQÑAQÑ5QØ×&Ñ&¨ zÓ2�ØˆJð Rús   ƒ(A$«A"¬7A$r  c                óÀ   •K  — ‰2 3 d {  –—† }  ‰t         j                  j                  | g«      «      ƒ d {  –—† }|j                  «       D ]  }|­–— Œ	 ŒR7 ŒM7 Œ!6 y ­wrO   r  )r  rã   Ú	convertedr  rÛ   s      €€rT   r  z*AsyncQueryBase.to_batches.<locals>.batchesE  s^   øè ø€ Ø%÷ $ð $�eÙ#¤B§H¡H×$9Ñ$9¸5¸'Ó$BÓC×C�Ø!$§¡Ó!1ò $�IØ#”Oñ$ð$øØCøñ  &ùs5   ƒA†AŠA‹AŽ*A¸A¹AÁAÁAÁAr	  )r·  Ú_execute_batchesrù   r@   r  rM   r   Ú_from_batches)	rQ   r�  r°  rR   rM   r  rì   r  rÛ   s	   `  `  @@@rT   rÃ  zAsyncQueryBase.to_batches  s¬   üè ø€ ðB "×9Ñ9¸)ÓD×DˆØ×,Ñ,Ø-°wð -ó 
÷ 
ˆð ˜ÒØˆM÷	ñ  ¤§¡× 5Ñ 5°bÀÇÁÐ 5Ó OÓP×P×XÑXˆõ	$ô &×3Ñ3°F¹G»IÓFÐFð- Eøð
øð Qús2   ‡B5œB/�B5·B1¸AB5Á?B3Â 0B5Â1B5Â3B5r’  c             ƒ  óž   K  — | j                  «       ƒ d {  –—†  t        | j                  j                  ||¬«      ƒ d {  –—† «      S 7 Œ27 Œ
­w©Nr’  )rx  r   ro   Úexecute©rQ   r�  r°  s      rT   r–  zAsyncQueryBase._execute_batchesM  sS   è ø€ ð ×)Ñ)Ó+×+Ð+Ü%Ø—+‘+×%Ñ%Ø!1¸7ð &ó ÷ ó
ð 	
ð 	,øðús!   ‚A–A	—)AÁ AÁ	AÁAc              ƒ  óR   K  — | j                   j                  «       ƒ d{  –—† S 7 Œ­w)r•  N)ro   r´  rY   s    rT   r´  zAsyncQueryBase.output_schemaZ  s!   è ø€ ð —[‘[×.Ñ.Ó0×0Ð0Ð0ús   ‚' %¡'c              ƒ  óÌ  K  — t        |«       |dk(  s| j                  €i S | j                  j                  «       ƒ d{  –—† }t        | j                  j                  «       «      }t        ||«      }|dk7  r|S t        |||«       |r4t        | j                  | j                  j                  «      s
t        «       ‚t        | j                  «       ƒ d{  –—† |«       |S 7 Œ¡7 Œ­w)rí  rÑ   Nrî  )r4   ry   rM   r¶   ro   rs  r-   r/   rs   rï  rw   r0   rð  )rQ   rR   rM   r°   rì   s        rT   r·  z&AsyncQueryBase._validated_blob_sourcesb  sÉ   è ø€ ô
 	˜9Ô%à˜Ò $§+¡+Ð"5ØˆIØ—{‘{×)Ñ)Ó+×+ˆÜ.¨t¯{©{×/KÑ/KÓ/MÓNˆ
Ü1°&¸*ÓEˆØ˜ÒØÐÜ'¨°
¸LÔIÙÔ :Ø�K‰K˜Ÿ™×9Ñ9ô!
ô 5Ó6Ð6Ü%¨D×,DÑ,DÓ,F×&FÈÔUØÐð ,øð 'Gús"   ‚<C$¾C ¿BC$ÃC"ÃC$Ã"C$c              ƒ  ó>   K  — | j                  «       ƒ d {  –—† S 7 Œ­wrO   rò  rY   s    rT   rð  z"AsyncQueryBase._blob_output_schemax  s   è ø€ Ø×'Ñ'Ó)×)Ð)Ð)ús   ‚–—c              ƒ  ó�   K  — |dk(  r|S |dk(  rt        ||«      S t        ||| j                  j                  «      ƒ d {  –—† S 7 Œ­wrô  )r3   r1   ry   rí   rõ  s       rT   rö  z%AsyncQueryBase._apply_arrow_blob_mode{  sR   è ø€ ð ˜ÒØˆJØ˜Ò&Ü% c¨<Ó8Ð8Ü7Ø�˜tŸ{™{×6Ñ6ó
÷ 
ð 	
ð 
ús   ‚=A¿AÁ ArÍ  c             ƒ  óV  K  — | j                  |«      ƒ d{  –—† }| j                  |¬«      ƒ d{  –—† }| j                  t        j                  j                  |j                  «       ƒ d{  –—† |j                  ¬«      «      }| j                  |||«      ƒ d{  –—† S 7 Œ‰7 Œq7 Œ77 Œ
­w)aÆ  
        Execute the query and collect the results into an Apache Arrow Table.

        This method will collect all results into memory before returning.  If
        you expect a large number of results, you may want to use
        [to_batches][lancedb.query.AsyncQueryBase.to_batches]

        Parameters
        ----------
        timeout: Optional[timedelta]
            The maximum time to wait for the query to complete.
            If not specified, no timeout is applied. If the query does not
            complete within the specified time, an error will be raised.
        blob_mode: str, default "lazy"
            ``"lazy"`` returns blob v2 descriptors that carry the row id
            ``fetch_blobs`` reads. ``"descriptions"`` returns them without it.
            ``"bytes"`` returns payload bytes and raises for legacy blob columns
            and blobs inside lists.
            Remote tables and namespace query pushdown refuse ``"bytes"``.
        Nr²  r  )	r·  rÃ  rý  rù   r@   r  rÙ   rM   rö  )rQ   r°  rR   rì   Ú
batch_iterrã   s         rT   r¸  zAsyncQueryBase.to_arrow†  s“   è ø€ ð4 "×9Ñ9¸)ÓD×DˆØŸ?™?°7˜?Ó;×;ˆ
Ø×-Ñ-Ü�H‰H×!Ñ!¨
×(;Ñ(;Ó(=×"=Àj×FWÑFWÐ!ÓXó
ˆð ×0Ñ0°°iÀÓN×NÐNð EøØ;øà"=øàNúsC   ‚B)—B!˜B)±B#²;B)Á-B%Á..B)ÂB'ÂB)Â#B)Â%B)Â'B)c             ƒ  ó`   K  — | j                  ||¬«      ƒ d{  –—† j                  «       S 7 Œ­w)á¼  
        Execute the query and return the results as a list of dictionaries.

        Each list entry is a dictionary with the selected column names as keys,
        or all table columns if `select` is not called. The vector and the "_distance"
        fields are returned whether or not they're explicitly selected.

        Parameters
        ----------
        timeout: Optional[timedelta]
            The maximum time to wait for the query to complete.
            If not specified, no timeout is applied. If the query does not
            complete within the specified time, an error will be raised.
        blob_mode: str, default "lazy"
            Passed through to :meth:`to_arrow`.
        r¼  NrÈ  r¿  s      rT   rÅ  zAsyncQueryBase.to_list§  s*   è ø€ ð, —m‘m¨G¸y�mÓI×I×TÑTÓVÐVÐIús   ‚.™,š.c             ‹  óò  K  — t        |«       | j                  �[| j                  j                  j                  «       s7| j	                  |«      ƒ d{  –—†   | j
                  d
|||dœ|¤Žƒ d{  –—† S t        | j                  d«      rat        | j                  «       ƒ d{  –—† «      r@|�|dk7  r#|€! | j                  |fd|i|¤Žƒ d{  –—† }|�|S t        | «      rt        d«      ‚|dk(  rdn|}| j                  ||¬«      ƒ d{  –—† }|dk(  r9t        |j                  «      r$| j	                  d«      ƒ d{  –—† st        d	«      ‚ t        ||«      j                  d
i |¤ŽS 7 �Œ7 Œü7 ŒË7 Œ£7 Œg7 Œ6­w)aO  
        Execute the query and collect the results into a pandas DataFrame.

        This method will collect all results into memory before returning.  If you
        expect a large number of results, you may want to use
        [to_batches][lancedb.query.AsyncQueryBase.to_batches] and convert each batch to
        pandas separately.

        Examples
        --------

        >>> import asyncio
        >>> from lancedb import connect_async
        >>> async def doctest_example():
        ...     conn = await connect_async("./.lancedb")
        ...     table = await conn.create_table("my_table", data=[{"a": 1, "b": 2}])
        ...     async for batch in await table.query().to_batches():
        ...         batch_df = batch.to_pandas()
        >>> asyncio.run(doctest_example())

        Parameters
        ----------
        flatten: Optional[Union[int, bool]]
            If flatten is True, flatten all nested columns.
            If flatten is an integer, flatten the nested columns up to the
            specified depth.
            If unspecified, do not flatten the nested columns.
        timeout: Optional[timedelta]
            The maximum time to wait for the query to complete.
            If not specified, no timeout is applied. If the query does not
            complete within the specified time, an error will be raised.
        blob_mode: str, default "lazy"
            Controls how blob columns are returned. Local blob v2 queries support
            ``"bytes"`` and ``"descriptions"`` without pylance. Eligible local
            plain scans use pylance's scanner for lazy blob handles in ``"lazy"``
            mode and for legacy blob columns. Other local blob v2
            queries return descriptors in ``"lazy"`` and ``"descriptions"``
            modes, or payloads in ``"bytes"`` mode, through :meth:`to_arrow`.
            Remote blob queries support only ``"descriptions"`` until a stable
            table snapshot can bind the query and blob fetches.
        **kwargs
            Forwarded to pyarrow.Table.to_pandas after query execution and
            optional flattening.
        N)rï   r°  rR   r´  rÑ   rï   rµ  rò   r¼  r¶  rP   )r4   ry   ro   rp   r·  Ú_remote_to_pandasrÔ   r$   r´  r¹  r…   rl   r¸  rM   r&   rU   )rQ   rï   r°  rR   rS   rÕ   r»  rã   s           rT   rU   zAsyncQueryBase.to_pandas¿  sš  è ø€ ôh 	˜9Ô%Ø�;‰;Ð"¨4¯;©;×+=Ñ+=×+HÑ+HÔ+JØ×.Ñ.¨yÓ9×9Ð9Ø/˜×/Ñ/ð Ø¨¸IñØIOñ÷ ð ô �4—;‘; Ô0Ô5JØ×$Ñ$Ó&×&ô6
ð � 9°Ò#6¸G¸OØ5˜4×5Ñ5ØñØ'.ðØ28ñ÷ �ð �>Ø�IÜ)¨$Ô/Ü4ØPóð ð (1°FÒ':‘^À	ˆ
Ø—M‘M¨'¸Z�MÓH×Hˆà˜ÒÜ% c§j¡jÔ1Ø×6Ñ6°~ÓF×FÐFä0Ø;óð ð 7Œ˜s GÓ,×6Ñ6Ñ@¸Ñ@Ð@ð; :ùðøð
 'øðøð Iøð Gúsl   ‚AE7ÁE*ÁE7Á0E-Á12E7Â#E/Â$)E7ÃE1Ã=E7ÄE3Ä2E7Ä>E5Ä?,E7Å-E7Å/E7Å1E7Å3E7Å5E7c             ‹  óv   K  — | j                  |¬«      ƒ d {  –—† }t        |f|| j                  |dœ|¤ŽS 7 Œ­w)Nr²  r³  )r¸  rô   rp  )rQ   rï   r°  rR   rS   rã   s         rT   r¥  z AsyncQueryBase._remote_to_pandas  sN   è ø€ ð —M‘M¨'�MÓ2×2ˆÜ$Øð
àØ×'Ñ'Øñ	
ð
 ñ
ð 	
ð 3ús   ‚9˜7™9c              ‹  óØ  K  — | j                   €y | j                  «       }t        |«      sy | j                   j                  «       ƒ d {  –—† }t	        ||j
                  | j                  ¬«      }|dk(  rt        ||j
                  «      ni }|rt        ||j
                  |«       | j                   j                  j                  «       r.t        | j                   j                  «       ƒ d {  –—† «      dk(  ry |dk7  r"t        | «      st        ||j
                  «      ry 	 | j                   j                  «       ƒ d {  –—† } |j$                  di t'        ||rdn|||j(                  xs |xs t+        |«      ¬«      ¤Ž}
t-        |
f||| j                   j.                  | j                  du|dœ|¤Žƒ d {  –—† S 7 �Œr7 ŒÑ7 Œ�# t        $ r}	t!        t#        |	«      «      |	‚d }	~	ww xY w7 Œ1­w)	Nr·   rî  r3  rÑ   rò   Tr4  rP   )ry   r~   rŒ   rM   r,   r¦   rŸ  r-   r/   ro   rp   r'   Úurir…   r6  r7  rl   r    rÚ   rÂ   r¸   r�   rö   rí   )rQ   rR   rï   rS   r„   rM   rú  rì   r¿   rá   rÚ   s              rT   r¹  z$AsyncQueryBase._plain_scan_to_pandas%  sÑ  è ø€ ð �;‰;ÐØà×$Ñ$Ó&ˆÜ# EÔ*Øà—{‘{×)Ñ)Ó+×+ˆÜ4ØØ�M‰MØ×)Ñ)ô
Ðð ˜GÒ#ô ' v¨u¯}©}Ô=àð 	ñ
 Ü+¨F°E·M±MÀ<ÔPà�{‰{×!Ñ!×,Ñ,Ô.Ü §¡§¡Ó!2×2Ó3°xÒ?àà˜ÒÜ.¨tÔ4Ü*¨6°5·=±=ÔAàð	DØ ŸK™K×0Ñ0Ó2×2ˆGð "�'—/‘/ñ 
Ü'ØÙ".‘°IØØ!×-Ñ-ÒWÐ1AÒWÄTÈ,ÓEWô	ñ
ˆô 5Øð
àØ%ØŸ™×/Ñ/Ø"×/Ñ/°tÐ;Øñ
ð ñ
÷ 
ð 	
ðI ,ùð 3øð 3ùÜò 	DÜ0´°S³Ó:ÀÐCûð	Dúð
úsh   ‚AG*Á	F;Á
B"G*Ã,F>Ã-3G*Ä!G Ä>G Ä?G ÅA3G*Æ6G(Æ7G*Æ>G*Ç G Ç	G%ÇG Ç G%Ç%G*c              ƒ  ój   K  — ddl } |j                  | j                  |¬«      ƒ d{  –—† «      S 7 Œ­w)áa  
        Execute the query and collect the results into a Polars DataFrame.

        This method will collect all results into memory before returning.  If you
        expect a large number of results, you may want to use
        [to_batches][lancedb.query.AsyncQueryBase.to_batches] and convert each batch to
        polars separately.

        Parameters
        ----------
        timeout: Optional[timedelta]
            The maximum time to wait for the query to complete.
            If not specified, no timeout is applied. If the query does not
            complete within the specified time, an error will be raised.

        Examples
        --------

        >>> import asyncio
        >>> import polars as pl
        >>> from lancedb import connect_async
        >>> async def doctest_example():
        ...     conn = await connect_async("./.lancedb")
        ...     table = await conn.create_table("my_table", data=[{"a": 1, "b": 2}])
        ...     async for batch in await table.query().to_batches():
        ...         batch_df = pl.from_arrow(batch)
        >>> asyncio.run(doctest_example())
        r   Nr²  rÍ  rÐ  s      rT   rÒ  zAsyncQueryBase.to_polars`  s.   è ø€ ó@ 	àˆr�}‰} 4§=¡=¸ =Ó#A×AÓBÐBÐAús   ‚&3¨1©	3r²  c             ƒ  ó�   K  — | j                  |¬«      ƒ d{  –—† j                  «       D �cg c]
  } |di |¤Ž‘Œ c}S 7 Œ&c c}w ­w)av  
        Convert results to a list of pydantic models.

        Parameters
        ----------
        model : Type[LanceModel]
            The pydantic model to use.
        timeout : timedelta, optional
            The maximum time to wait for the query to complete.
            If None, wait indefinitely.

        Returns
        -------
        list[LanceModel]
        r²  NrP   rÈ  rÉ  s       rT   rË  zAsyncQueryBase.to_pydantic„  sE   è ø€ ð& ,0¯=©=À¨=Ó+I×%I×$TÑ$TÓ$Vö
Ø ‰E‰L�C‹Lò
ð 	
Ø%Iúò
ùs   ‚A˜?™A­A¼AÁAc              ƒ  óT   K  — | j                   j                  |«      ƒ d{  –—† S 7 Œ­w)áš  Return the execution plan for this query.

        Examples
        --------
        >>> import asyncio
        >>> from lancedb import connect_async
        >>> async def doctest_example():
        ...     conn = await connect_async("./.lancedb")
        ...     table = await conn.create_table("my_table", [{"vector": [99.0, 99.0]}])
        ...     plan = await table.query().nearest_to([1.0, 2.0]).explain_plan(True)
        ...     print(plan)
        >>> asyncio.run(doctest_example()) # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
        ProjectionExec: expr=[vector@0 as vector, _distance@2 as _distance]
          GlobalLimitExec: skip=0, fetch=10
            FilterExec: _distance@2 IS NOT NULL
              SortExec: TopK(fetch=1), expr=[_distance@2 ASC NULLS LAST, _rowid@1 ASC NULLS LAST], preserve_partitioning=[false]
                KNNVectorDistance: metric=l2
                  LanceRead: uri=..., projection=[vector], num_fragments=..., ...
        <BLANKLINE>
        <BLANKLINE>

        Parameters
        ----------
        verbose : bool, default False
            Use a verbose output format.

        Returns
        -------
        plan : str
        N)ro   r  r  s     rT   r  zAsyncQueryBase.explain_planš  s#   è ø€ ð> —[‘[×-Ñ-¨gÓ6×6Ð6Ð6úó   ‚(¡&¢(c              ƒ  óT   K  — | j                   j                  |«      ƒ d{  –—† S 7 Œ­w)r`  N)ro   r'  r&  s     rT   r'  zAsyncQueryBase.analyze_plan»  s$   è ø€ ð —[‘[×-Ñ-Ð.AÓB×BÐBÐBúr®  rO   )rq  z3Union[LanceQuery, LanceVectorQuery, LanceTakeQuery]r{   úOptional['AsyncTable']rI  rH  r	  )r_   ÚNone©r¦   z Union[List[str], dict[str, str]]r_   rC   ©r_   rC   rE  rO  rP  rQ  )r�  r4  r°  r>  rR   r5   r_   r   ©r�  r4  r°  r>  r_   r   rL  rJ  rN  r?  rB  r°  ©rï   r=  r°  r>  rR   r5   r_   r<  r[  rC  )rÊ  zType[LanceModel]r°  r>  r_   zList[LanceModel]rS  ©r  rW  rV  rW  )rb   rc   rd   r  r©  r~   rã  ræ  rý  rx  r´   r¸   r‚   r  r€   rÃ  r–  r´  r·  rð  rö  r¸  rÅ  rU   r¥  r¹  rÒ  rË  r  r'  rP   rW   rT   rm  rm  ~  se  „ ñð )-ð/àBð/ð &ó/ó(ó)ó&ó
ó"ó(.ó`ôóóð +/Ø'+Ø$ñ7Gð (ð7Gð %ð	7Gð
 ð7Gð 
 ó7Gðx +/Ø'+ñ	
ð (ð
ð %ð	
ð
 
 ó
ó1óó,*ð	
Øð	
Ø(0ð	
Ø@Nð	
à	ó	
ð (,ðOð %ñ	Oà$ðOð ð	Oð
 
óOðF (,ðWð %ñ	Wà$ðWð ð	Wð
 
óWð4 /3Ø'+ðSAð
 %ñSAà+ðSAð %ðSAð
 ðSAð 
óSAðj
ð ,ð
ð %ð	
ð
 ð
ð 
ó
ð( /3ð9
àð9
ð ,ð9
ð
 
"ó9
ðz (,ð"Cà$ð"Cð 
ó"CðJ JNñ
Ø%ð
Ø3Fð
à	ó
ô,7ðD DOðCØ#@ðCà	ôCrW   rm  c                  óf   ‡ — e Zd ZdZ	 d
	 	 	 dˆ fd„Zdd„Zdd„Zdd„Zdd„Zdd„Z	dd„Z
dd	„Zˆ xZS )ÚAsyncStandardQueryzJ
    Base class for "standard" async queries (all but take currently)
    c                ó&   •— t         ‰| �  ||«       y)zÔ
        Construct an AsyncStandardQuery

        This method is not intended to be called directly.  Instead, use the
        [AsyncTable.query][lancedb.table.AsyncTable.query] method to create a query.
        N©r`  r©  ©rQ   rq  r{   rn  s      €rT   r©  zAsyncStandardQuery.__init__Ò  s   ø€ ô 	‰Ñ˜ Õ&rW   c                óª   — t        |t        «      r'| j                  j                  |j                  «       | S | j                  j	                  |«       | S )ay  
        Only return rows matching the given predicate

        The predicate can be a SQL string or a type-safe
        :class:`~lancedb.expr.Expr` built with :func:`~lancedb.expr.col`
        and :func:`~lancedb.expr.lit`.

        Examples
        --------

        >>> predicate = "x > 10"
        >>> predicate = "y > 0 AND y < 100"
        >>> predicate = "x > 5 OR y = 'test'"

        Filtering performance can often be improved by creating a scalar index
        on the filter column(s).

        Calling this multiple times combines the filters with a logical AND
        rather than replacing the previous filter.
        )r�   r   ro   Ú
where_exprrÝ  )rQ   Ú	predicates     rT   rÝ  zAsyncStandardQuery.whereß  sF   € ô* �i¤Ô&Ø�K‰K×"Ñ" 9×#3Ñ#3Ô4ð ˆð �K‰K×Ñ˜iÔ(ØˆrW   c                ó<   — | j                   j                  |«       | S )zÌ
        Set the maximum number of results to return.

        By default, a plain search has no limit.  If this method is not
        called then every valid row from the table will be returned.
        )ro   rº   rÔ  s     rT   rº   zAsyncStandardQuery.limitú  s   € ð 	�‰×Ñ˜%Ô ØˆrW   c                ó<   — | j                   j                  |«       | S )z£
        Set the offset for the results.

        Parameters
        ----------
        offset: int
            The offset to start fetching results from.
        )ro   r»   rÖ  s     rT   r»   zAsyncStandardQuery.offset  s   € ð 	�‰×Ñ˜6Ô"ØˆrW   c                ó¼   — |€| j                   j                  d«       | S | j                   j                  |D �cg c]  }|j                  «       ‘Œ c}«       | S c c}w )zú
        Set the ordering for the results.

        Parameters
        ----------
        ordering: Optional[List[ColumnOrdering]]
            The ordering to use for the results.  If None, then the default ordering
            will be used.
        N)ro   r‹   Ú
model_dump)rQ   r!  rj  s      rT   r‹   zAsyncStandardQuery.order_by  sS   € ð ÐØ�K‰K× Ñ  Ô&ð ˆð �K‰K× Ñ ¸(Ö!C°Q !§,¡,¥.Ò!CÔDØˆùò "Ds   ¹Ac                ó:   — | j                   j                  «        | S )a,  
        Skip searching un-indexed data.

        This can make queries faster, but will miss any data that has not been
        indexed.

        !!! tip
            You can add new data into an existing index by calling
            [AsyncTable.optimize][lancedb.table.AsyncTable.optimize].
        )ro   r¼   rY   s    rT   r¼   zAsyncStandardQuery.fast_search   s   € ð 	�‰×ÑÔ!ØˆrW   c                ó<   — | j                   j                  |«       | S )a  
        Control RTE LSM read routing for this query.

        By default (unset), a query against a table with an RTE write spec (see
        [AsyncTable.enable_rte][lancedb.table.AsyncTable.enable_rte])
        is routed through the LSM scanner so it also returns data written via the
        ``merge_insert`` LSM path that has not yet been compacted into the base
        table (the active/frozen in-memory memtables and the SSTables),
        deduplicated by primary key; a table without a spec reads the base table.

        Parameters
        ----------
        enable : bool
            ``True`` forces the LSM scanner and errors if the table has no RTE
            write spec. ``False`` bypasses the RTE and reads the base table
            only, even when a spec is present.
        ©ro   rb  r  s     rT   rb  zAsyncStandardQuery.use_rte.  s   € ð$ 	�‰×Ñ˜FÔ#ØˆrW   c                ó:   — | j                   j                  «        | S )ax  
        If this is called then filtering will happen after the search instead of
        before.
        By default filtering will be performed before the search.  This is how
        filtering is typically understood to work.  This prefilter step does add some
        additional latency.  Creating a scalar index on the filter column(s) can
        often improve this latency.  However, sometimes a filter is too complex or
        scalar indices cannot be applied to the column.  In these cases postfiltering
        can be used instead of prefiltering to improve latency.
        Post filtering applies the filter to the results of the search.  This
        means we only run the filter on a much smaller set of data.  However, it can
        cause the query to return fewer than `limit` results (or even no results) if
        none of the nearest results match the filter.
        Post filtering happens during the "refine stage" (described in more detail in
        @see {@link VectorQuery#refineFactor}).  This means that setting a higher refine
        factor can often help restore some of the results lost by post filtering.
        )ro   rŠ   rY   s    rT   rŠ   zAsyncStandardQuery.postfilterC  s   € ð$ 	�‰×ÑÔ ØˆrW   rO   )rq  z#Union[LanceQuery, LanceVectorQuery]r{   r°  )r¾  rF  r_   rC   )rº   r7  r_   rC   rD  rU  r³  rR  )rb   rc   rd   r  r©  rÝ  rº   r»   r‹   r¼   rb  rŠ   r²  r³  s   @rT   r¸  r¸  Í  sG   ø„ ñð )-ð'à2ð'ð &õ'óó6ó
óó ó÷*rW   r¸  c                  óZ   ‡ — e Zd Zddˆ fd„Zedd„«       Z	 	 	 	 dd„Z	 d	 	 	 	 	 d	d„Zˆ xZS )
Ú
AsyncQueryc                ó4   •— t         ‰| �  ||«       || _        y)zÌ
        Construct an AsyncQuery

        This method is not intended to be called directly.  Instead, use the
        [AsyncTable.query][lancedb.table.AsyncTable.query] method to create a query.
        N)r`  r©  ro   r»  s      €rT   r©  zAsyncQuery.__init__Z  s   ø€ ô 	‰Ñ˜ Ô&Øˆ�rW   c                óª  — t        |t        «      rt        j                  |«      S t        |t        j
                  «      rt        j                  |«      S t        |t        j                  «      r|S t        |t        j                  «      r|j                  «       S t        |t        «      rt        j                  |«      S t        j                  |«      S rO   )
r�   r«   rù   rƒ  r‚  r…  rú   r‡  Úcombine_chunksr©   )rQ   Úvecs     rT   Ú_query_vec_to_arrayzAsyncQuery._query_vec_to_arrayd  sŽ   € ä�cœ4Ô Ü—8‘8˜C“=Ð Ü�cœ2Ÿ:™:Ô&Ü—8‘8˜C“=Ð Ü�cœ2Ÿ8™8Ô$ØˆJÜ�cœ2Ÿ?™?Ô+Ø×%Ñ%Ó'Ð'Ü�cœ5Ô!Ü—8‘8˜C“=Ð ô �x‰x˜‹}ÐrW   c                ój  — |€t        d«      ‚t        |t        t        j                  t
        j                  f«      r±t        |«      dkD  r£t        |d   t        t        j                  t
        j                  f«      rq|D �cg c]  }t        j                  |«      ‘Œ }}| j                  j                  |d   «      }|dd D ]  }|j                  |«       Œ t        || j                  «      S t        | j                  j                  t        j                  |«      «      | j                  «      S c c}w )aš
  
        Find the nearest vectors to the given query vector.

        This converts the query from a plain query to a vector query.

        This method will attempt to convert the input to the query vector
        expected by the embedding model.  If the input cannot be converted
        then an error will be thrown.

        By default, there is no embedding model, and the input should be
        something that can be converted to a pyarrow array of floats.  This
        includes lists, numpy arrays, and tuples.

        If there is only one vector column (a column whose data type is a
        fixed size list of floats) then the column does not need to be specified.
        If there is more than one vector column you must use
        [AsyncVectorQuery.column][lancedb.query.AsyncVectorQuery.column] to specify
        which column you would like to compare with.

        If no index has been created on the vector column then a vector query
        will perform a distance comparison between the query vector and every
        vector in the database and then sort the results.  This is sometimes
        called a "flat search"

        For small databases, with tens of thousands of vectors or less, this can
        be reasonably fast.  In larger databases you should create a vector index
        on the column.  If there is a vector index then an "approximate" nearest
        neighbor search (frequently called an ANN search) will be performed.  This
        search is much faster, but the results will be approximate.

        The query can be further parameterized using the returned builder.  There
        are various ANN search parameters that will let you fine tune your recall
        accuracy vs search latency.

        Vector searches always have a
        [limit][lancedb.query.AsyncVectorQuery.limit].  If `limit` has not been
        called then a default `limit` of 10 will be used.

        Typically, a single vector is passed in as the query. However, you can also
        pass in multiple vectors. When multiple vectors are passed in, if the vector
        column is with multivector type, then the vectors will be treated as a single
        query. Or the vectors will be treated as multiple queries, this can be useful
        if you want to find the nearest vectors to multiple query vectors. Flat
        searches share one table scan across the query vectors, avoiding the scan
        and memory amplification of making multiple queries concurrently. If
        multiple vectors are passed in then
        an additional column `query_index` will be added to the results. This column
        will contain the index of the query vector that the result is nearest to.
        Núquery_vector can not be Noner   r   )rÆ   r�   r«   r‚  r…  rù   rú   rª   rÈ  rÍ  ro   Ú
nearest_toÚadd_query_vectorÚAsyncVectorQueryry   ©rQ   rh  rž  Úquery_vectorsÚnew_selfs        rT   rÐ  zAsyncQuery.nearest_tou  s  € ðj ÐÜÐ;Ó<Ð<ô �|¤d¬B¯J©J¼¿¹Ð%AÔBÜ�LÓ! AÒ%Ü˜<¨™?¬T´2·:±:¼r¿x¹xÐ,HÔIð IUÖUÀ1œZ×;Ñ;¸AÕ>ÐUˆMÐUØ—{‘{×-Ñ-¨m¸AÑ.>Ó?ˆHØ" 1 2Ð&ò -�Ø×)Ñ)¨!Õ,ð-ä# H¨d¯k©kÓ:Ð:ä#Ø—‘×&Ñ&¤z×'EÑ'EÀlÓ'SÓTØ—‘óð ùò Vs   ÂD0c                ó  — t        |t        «      r|g}|€g }t        |t        «      r2t        | j                  j	                  ||dœ«      | j
                  «      S t        | j                  j	                  d|i«      | j
                  «      S )aò  
        Find the documents that are most relevant to the given text query.

        This method will perform a full text search on the table and return
        the most relevant documents.  The relevance is determined by BM25.

        The columns to search must be with native FTS index
        (Tantivy-based can't work with this method).

        By default, all indexed columns are searched,
        now only one column can be searched at a time.

        Parameters
        ----------
        query: str
            The text query to search for.
        columns: str or list of str, default None
            The columns to search in. If None, all indexed columns are searched.
            For now only one column can be searched at a time.
        rÆ  r„   )r�   r    ÚAsyncFTSQueryro   Únearest_to_textry   ©rQ   r„   r¦   s      rT   rØ  zAsyncQuery.nearest_to_text¾  s{   € ô. �gœsÔ#Ø�iˆGØˆ?ØˆGä�eœSÔ!Ü Ø—‘×+Ñ+°eÈÑ,PÓQØ—‘óð ô
 ˜TŸ[™[×8Ñ8¸'À5Ð9IÓJÈDÏKÉKÓXÐXrW   rO   )rq  Ú
LanceQueryr{   r°  )rÌ  rY  )rh  úUnion[VEC, Tuple, List[VEC]]r_   rÒ  )r„   rZ  r¦   úUnion[str, List[str], None]r_   r×  )	rb   rc   rd   r©  rm  rÍ  rÐ  rØ  r²  r³  s   @rT   rÈ  rÈ  Y  s_   ø„ öð òó ðð Gà2ðGð 
óGðT RVð"YØ(ð"YØ3Nð"Yà	÷"YrW   rÈ  c                  óx   ‡ — e Zd ZdZd	d
ˆ fd„Zdd„Z e«       f	 	 	 dd„Z	 	 	 	 dd„Zdddœ	 	 	 	 	 dˆ fd„Z	ˆ xZ
S )r×  z)A query for full text search for LanceDB.Nc                óB   •— t         ‰| �  ||«       || _        d | _        y rO   )r`  r©  ro   rk  r»  s      €rT   r©  zAsyncFTSQuery.__init__æ  s    ø€ Ü‰Ñ˜ Ô&ØˆŒØˆ�rW   c                ó6   — | j                   j                  «       S rO   )ro   Ú	get_queryrY   s    rT   rà  zAsyncFTSQuery.get_queryë  s   € Ø�{‰{×$Ñ$Ó&Ð&rW   c                óN   — |rt        |t        «      st        d«      ‚|| _        | S )Nr>  )r�   r   rÆ   rk  r/  s     rT   r1  zAsyncFTSQuery.rerankî  s(   € ñ œJ x´Ô:ÜÐNÓOÐOà!ˆŒàˆrW   c                óú  — |€t        d«      ‚t        |t        «      r˜t        |«      dkD  rŠt        |d   t        t
        f«      sq|D �cg c]  }t        j                  |«      ‘Œ }}| j                  j                  |d   «      }|dd D ]  }|j                  |«       Œ t        || j                  «      S t        | j                  j                  t        j                  |«      «      | j                  «      S c c}w )a5
  
        In addition doing text search on the LanceDB Table, also
        find the nearest vectors to the given query vector.

        This converts the query from a FTS Query to a Hybrid query. Results
        from the vector search will be combined with results from the FTS query.

        This method will attempt to convert the input to the query vector
        expected by the embedding model.  If the input cannot be converted
        then an error will be thrown.

        By default, there is no embedding model, and the input should be
        something that can be converted to a pyarrow array of floats.  This
        includes lists, numpy arrays, and tuples.

        If there is only one vector column (a column whose data type is a
        fixed size list of floats) then the column does not need to be specified.
        If there is more than one vector column you must use
        [AsyncVectorQuery.column][lancedb.query.AsyncVectorQuery.column] to specify
        which column you would like to compare with.

        If no index has been created on the vector column then a vector query
        will perform a distance comparison between the query vector and every
        vector in the database and then sort the results.  This is sometimes
        called a "flat search"

        For small databases, with tens of thousands of vectors or less, this can
        be reasonably fast.  In larger databases you should create a vector index
        on the column.  If there is a vector index then an "approximate" nearest
        neighbor search (frequently called an ANN search) will be performed.  This
        search is much faster, but the results will be approximate.

        The query can be further parameterized using the returned builder.  There
        are various ANN search parameters that will let you fine tune your recall
        accuracy vs search latency.

        Hybrid searches always have a
        [limit][lancedb.query.AsyncHybridQuery.limit].  If `limit` has not been
        called then a default `limit` of 10 will be used.

        Typically, a single vector is passed in as the query. However, you can also
        pass in multiple vectors.  This can be useful if you want to find the nearest
        vectors to multiple query vectors. Flat searches share one table scan across
        the query vectors instead of issuing concurrent full scans.
        If multiple vectors are passed in then an additional column `query_index`
        will be added to the results.  This column will contain the index of the
        query vector that the result is nearest to.
        NrÏ  r   r   )rÆ   r�   r«   rª   rø   r7  rÈ  rÍ  ro   rÐ  rÑ  ÚAsyncHybridQueryry   rÓ  s        rT   rÐ  zAsyncFTSQuery.nearest_toù  sé   € ðh ÐÜÐ;Ó<Ð<ô �|¤TÔ*Ü�LÓ! AÒ%Ü˜|¨A™´¼°Ô=ð IUÖUÀ1œZ×;Ñ;¸AÕ>ÐUˆMÐUØ—{‘{×-Ñ-¨m¸AÑ.>Ó?ˆHØ" 1 2Ð&ò -�Ø×)Ñ)¨!Õ,ð-ä# H¨d¯k©kÓ:Ð:ä#Ø—‘×&Ñ&¤z×'EÑ'EÀlÓ'SÓTØ—‘óð ùò Vs   Á	C8r’  c             ƒ  óJ  •K  — t         ‰| �  |¬«      ƒ d {  –—† }t        j                  j	                  |j                  «       ƒ d {  –—† |j                  «      }| j                  r*| j                  j                  | j                  «       |«      }t        ||¬«      S 7 Œ‡7 ŒX­w©Nr²  ©r�  )r`  r–  rù   r@   r  rÙ   rM   rk  rË  rà  r   ©rQ   r�  r°  rÛ   rÌ  rn  s        €rT   r–  zAsyncFTSQuery._execute_batchesA  s~   øè ø€ ô ‘wÑ/¸Ð/Ó@×@ˆÜ—(‘(×'Ñ'¨f¯o©oÓ.?×(?ÀÇÁÓOˆØ�>Š>Ø—n‘n×/Ñ/°·±Ó0@À'ÓJˆGÜ% gÐ@PÔQÐQð	 AøØ(?ús"   ƒB#—B˜0B#ÁB!Á	AB#Â!B#rO   )rq  ÚLanceFTSQueryr{   r°  r-  )r0  r   r_   r×  )rh  rÛ  r_   rã  r´  )rb   rc   rd   r  r©  rà  r    r1  rÐ  r–  r²  r³  s   @rT   r×  r×  ã  s~   ø„ Ù3öó
'ñ
 )›]ð	àð	ð 
ó	ðFà2ðFð 
óFðV +/Ø'+ñ	
Rð (ð
Rð %ð	
Rð
 
 ÷
Rñ 
RrW   r×  c                  ój   — e Zd Zdd„Zdd„Zdd„Zdd„Zdd„Z	 d	 	 	 	 	 dd„Zdd„Z	dd	„Z
dd
„Zdd„Zy)ÚAsyncVectorQueryBasec                ó<   — | j                   j                  |«       | S )aZ  
        Set the vector column to query

        This controls which column is compared to the query vector supplied in
        the call to [AsyncQuery.nearest_to][lancedb.query.AsyncQuery.nearest_to].

        This parameter must be specified if the table has more than one column
        whose data type is a fixed-size-list of floats.
        )ro   r£   )rQ   r£   s     rT   r£   zAsyncVectorQueryBase.columnO  s   € ð 	�‰×Ñ˜6Ô"ØˆrW   c                ó<   — | j                   j                  |«       | S )aœ  
        Set the legacy IVF probe parameter

        The number of probes must be greater than 0.

        This argument is only used when the vector column has an IVF-based index.
        If there is no index then this value is ignored.

        The IVF stage of IVF PQ divides the input into partitions (clusters) of
        related values.

        The partition whose centroids are closest to the query vector will be
        exhaustiely searched to find matches.  This parameter controls how many
        partitions will be searched.

        Increasing this value will increase the recall of your query but will
        also increase the latency of your query. If this method is not called,
        Lance's adaptive probe defaults are used.

        For best results we recommend tuning this parameter with a benchmark against
        your actual data to find the smallest possible value that will still give
        you the desired recall.

        LanceDB retains this as `nprobes` through local and remote request
        construction. Lance sets both probe bounds to this value. Explicit minimum
        or maximum settings can override their respective bounds.
        )ro   rY  r~  s     rT   rY  zAsyncVectorQueryBase.nprobes\  s   € ð8 	�‰×Ñ˜GÔ$ØˆrW   c                ó<   — | j                   j                  |«       | S )aö  Set the initial IVF search effort to a finite value in [0, 1].

        None preserves Auto (internally 0.5) and fixed nprobes. Any explicit
        effort, including 0.5, overrides nprobes in either call order; explicit
        minimum and maximum bounds remain effective. Zero starts at the caller
        minimum and one searches all partitions within the maximum. Later
        probing may continue to obtain enough candidates. This is not a recall
        guarantee and does not change refinement or HNSW ef. RTE LSM queries
        do not yet support this option.

        Examples
        --------
        >>> import asyncio
        >>> import lancedb
        >>> async def build_query():
        ...     db = await lancedb.connect_async("memory://")
        ...     table = await db.create_table(
        ...         "effort_async", [{"vector": [0.1, 0.2]}]
        ...     )
        ...     return table.vector_search([0.1, 0.2]).search_effort(0.75)
        >>> query = asyncio.run(build_query())
        )ro   r]  r�  s     rT   r]  z"AsyncVectorQueryBase.search_effort{  s   € ð. 	�‰×!Ñ! -Ô0ØˆrW   c                ó<   — | j                   j                  |«       | S )zßSet the minimum number of probes to use.

        See `nprobes` for more details.

        These partitions will be searched on every indexed vector query and will
        increase recall at the expense of latency.
        )ro   rZ  r„  s     rT   rZ  z$AsyncVectorQueryBase.minimum_nprobes•  s   € ð 	�‰×#Ñ# OÔ4ØˆrW   c                ó<   — | j                   j                  |«       | S r†  )ro   r[  rˆ  s     rT   r[  z$AsyncVectorQueryBase.maximum_nprobes   s   € ð 	�‰×#Ñ# OÔ4ØˆrW   Nc                ó>   — | j                   j                  ||«       | S )aÅ  Set the distance range to use.

        Only rows with distances within range [lower_bound, upper_bound)
        will be returned.

        Parameters
        ----------
        lower_bound: Optional[float]
            The lower bound of the distance range.
        upper_bound: Optional[float]
            The upper bound of the distance range.

        Returns
        -------
        AsyncVectorQuery
            The AsyncVectorQuery object.
        )ro   rŒ  r‹  s      rT   rŒ  z#AsyncVectorQueryBase.distance_range±  s   € ð( 	�‰×"Ñ" ;°Ô<ØˆrW   c                ó<   — | j                   j                  |«       | S )a  
        Set the number of candidates to consider during search

        This argument is only used when the vector column has an HNSW index.
        If there is no index then this value is ignored.

        Increasing this value will increase the recall of your query but will also
        increase the latency of your query.  The default value is 1.5 * limit.  This
        default is good for many cases but the best value to use will depend on your
        data and the recall that you need to achieve.
        )ro   rc  r�  s     rT   rc  zAsyncVectorQueryBase.efÈ  s   € ð 	�‰�‰�rÔØˆrW   c                ó<   — | j                   j                  |«       | S )aþ  
        A multiplier to control how many additional rows are taken during the refine
        step

        This argument is only used when the vector column has an IVF PQ index.
        If there is no index then this value is ignored.

        An IVF PQ index stores compressed (quantized) values.  They query vector is
        compared against these values and, since they are compressed, the comparison is
        inaccurate.

        This parameter can be used to refine the results.  It can improve both improve
        recall and correct the ordering of the nearest results.

        To refine results LanceDb will first perform an ANN search to find the nearest
        `limit` * `refine_factor` results.  In other words, if `refine_factor` is 3 and
        `limit` is the default (10) then the first 30 results will be selected.  LanceDb
        then fetches the full, uncompressed, values for these 30 results.  The results
        are then reordered by the true distance and only the nearest 10 are kept.

        Note: there is a difference between calling this method with a value of 1 and
        never calling this method at all.  Calling this method with any value will have
        an impact on your search latency.  When you call this method with a
        `refine_factor` of 1 then LanceDb still needs to fetch the full, uncompressed,
        values so that it can potentially reorder the results.

        Note: if this method is NOT called then the distances returned in the _distance
        column will be approximate distances based on the comparison of the quantized
        query vector and the quantized result vectors.  This can be considerably
        different than the true distance between the query vector and the actual
        uncompressed vector.
        )ro   r`  r’  s     rT   r`  z"AsyncVectorQueryBase.refine_factor×  s   € ðB 	�‰×!Ñ! -Ô0ØˆrW   c                ó<   — | j                   j                  |«       | S )aO  
        Set the distance metric to use

        When performing a vector search we try and find the "nearest" vectors according
        to some kind of distance metric.  This parameter controls which distance metric
        to use.  See @see {@link IvfPqOptions.distanceType} for more details on the
        different distance metrics available.

        Note: if there is a vector index then the distance type used MUST match the
        distance type used to train the vector index.  If this is not done then the
        results will be invalid.

        By default "l2" is used.
        )ro   rX  ry  s     rT   rX  z"AsyncVectorQueryBase.distance_typeû  s   € ð 	�‰×!Ñ! -Ô0ØˆrW   c                ó:   — | j                   j                  «        | S )aË  
        If this is called then any vector index is skipped

        An exhaustive (flat) search will be performed.  The query vector will
        be compared to every vector in the table.  At high scales this can be
        expensive.  However, this is often still useful.  For example, skipping
        the vector index can give you ground truth results which you can use to
        calculate your recall to select an appropriate value for nprobes.
        )ro   rd  rY   s    rT   rd  z(AsyncVectorQueryBase.bypass_vector_index  s   € ð 	�‰×'Ñ'Ô)ØˆrW   )r£   r    r_   rC   )rY  r7  r_   rC   )r]  r\  r_   rC   )rZ  r7  r_   rC   )r[  r7  r_   rC   r°  )r^  r\  r_  r\  r_   rC   )rc  r7  r_   rC   )r`  r7  r_   rC   )rX  r    r_   rC   r³  )rb   rc   rd   r£   rY  r]  rZ  r[  rŒ  rc  r`  rX  rd  rP   rW   rT   rê  rê  N  sT   „ óóó>ó4	óð$ SWðØ*ðØ@Oðà	óó.ó"óHô$rW   rê  c                  óx   ‡ — e Zd Zddˆ fd„Z e«       df	 	 	 	 	 d	d„Z	 d	 	 	 	 	 d
d„Zdddœ	 	 	 	 	 dˆ fd„Zˆ xZS )rÒ  Nc                óP   •— t         ‰| �  ||«       || _        d| _        d| _        y)až  
        Construct an AsyncVectorQuery

        This method is not intended to be called directly.  Instead, create
        a query first with [AsyncTable.query][lancedb.table.AsyncTable.query] and then
        use [AsyncQuery.nearest_to][lancedb.query.AsyncQuery.nearest_to]] to convert to
        a vector query.  Or you can use
        [AsyncTable.vector_search][lancedb.table.AsyncTable.vector_search]
        N)r`  r©  ro   rk  Ú_query_stringr»  s      €rT   r©  zAsyncVectorQuery.__init__  s*   ø€ ô 	‰Ñ˜ Ô&ØˆŒØˆŒØ!ˆÕrW   c                óŽ   — |rt        |t        «      st        d«      ‚|| _        | j                  s|st        d«      ‚|| _        | S )Nr>  z4query_string must be provided to rerank the results.)r�   r   rÆ   rk  r÷  r¨  s      rT   r1  zAsyncVectorQuery.rerank+  sG   € ñ œJ x´Ô:ÜÐNÓOÐOà!ˆŒà×!Ò!©,ÜÐSÓTÐTà)ˆÔàˆrW   c                ó  — t        |t        «      r|g}|€g }t        |t        «      r2t        | j                  j	                  ||dœ«      | j
                  «      S t        | j                  j	                  d|i«      | j
                  «      S )a‰  
        Find the documents that are most relevant to the given text query,
        in addition to vector search.

        This converts the vector query into a hybrid query.

        This search will perform a full text search on the table and return
        the most relevant documents, combined with the vector query results.
        The text relevance is determined by BM25.

        The columns to search must be with native FTS index
        (Tantivy-based can't work with this method).

        By default, all indexed columns are searched,
        now only one column can be searched at a time.

        Parameters
        ----------
        query: str
            The text query to search for.
        columns: str or list of str, default None
            The columns to search in. If None, all indexed columns are searched.
            For now only one column can be searched at a time.
        rÆ  r„   )r�   r    rã  ro   rØ  ry   rÙ  s      rT   rØ  z AsyncVectorQuery.nearest_to_text:  s€   € ô6 �gœsÔ#Ø�iˆGØˆ?ØˆGä�eœSÔ!Ü#Ø—‘×+Ñ+°eÈÑ,PÓQØ—‘óð ô
  Ø�K‰K×'Ñ'¨°%Ð(8Ó9¸4¿;¹;ó
ð 	
rW   r’  c             ƒ  óB  •K  — t         ‰| �  |¬«      ƒ d {  –—† }t        j                  j	                  |j                  «       ƒ d {  –—† |j                  «      }| j                  r&| j                  j                  | j                  |«      }t        ||¬«      S 7 Œƒ7 ŒT­wrå  )r`  r–  rù   r@   r  rÙ   rM   rk  r¢  r÷  r   rç  s        €rT   r–  z!AsyncVectorQuery._execute_batchesd  s}   øè ø€ ô ‘wÑ/¸Ð/Ó@×@ˆÜ—(‘(×'Ñ'¨f¯o©oÓ.?×(?ÀÇÁÓOˆØ�>Š>Ø—n‘n×2Ñ2°4×3EÑ3EÀwÓOˆGÜ% gÐ@PÔQÐQð	 AøØ(?ús"   ƒB—B˜0BÁBÁ	ABÂBrO   )rq  ÚLanceVectorQueryr{   r°  )r0  r   r©  r1  r_   rã  )r„   rZ  r¦   rÜ  r_   rã  r´  )	rb   rc   rd   r©  r    r1  rØ  r–  r²  r³  s   @rT   rÒ  rÒ    s‰   ø„ ö"ñ  $/£=ÐPTðØ ðØ@Mðà	óð  RVð(
Ø(ð(
Ø3Nð(
à	ó(
ðZ +/Ø'+ñ	
Rð (ð
Rð %ð	
Rð
 
 ÷
Rñ 
RrW   rÒ  c                  ó¬   ‡ — e Zd ZdZddˆ fd„Z e«       df	 	 	 	 	 dd„Zdd„Z	 	 dd„Zdddœ	 	 	 	 	 dd	„Z	dddœ	 	 	 	 	 dd
„Z
ddd„Z	 d	 	 	 dd„Zˆ xZS )rã  rØ  Nc                ón   •— t         ‰| �  ||«       || _        d| _        t	        «       | _        d | _        y )Nr§  )r`  r©  ro   rÚ  r    rk  rÛ  r»  s      €rT   r©  zAsyncHybridQuery.__init__}  s2   ø€ Ü‰Ñ˜ Ô&ØˆŒØˆŒ
Ü$›ˆŒð ;?ˆ�rW   r§  c                óz   — |dvrt        d«      ‚|rt        |t        «      st        d«      ‚|| _        || _        | S )a‹  
        Rerank the hybrid search results using the specified reranker. The reranker
        must be an instance of Reranker class.

        Parameters
        ----------
        reranker: Reranker, default RRFReranker()
            The reranker to use. Must be an instance of Reranker class.
        normalize: str, default "score"
            The method to normalize the scores. Can be "rank" or "score". If "rank",
            the scores are converted to ranks and then normalized. If "score", the
            scores are normalized directly.
        Returns
        -------
        AsyncHybridQuery
            The AsyncHybridQuery object.
        r<  r=  r>  )rÆ   r�   r   rÚ  rk  r?  s      rT   r1  zAsyncHybridQuery.rerank†  sD   € ð( Ð-Ñ-ÜÐCÓDÐDÙœJ x´Ô:ÜÐNÓOÐOàˆŒ
Ø!ˆŒàˆrW   c              ƒ  óš   K  — t        | j                  j                  «       | j                  «      }|j	                  «       ƒ d {  –—† S 7 Œ­wrO   )rÒ  ro   Úto_vector_queryry   r´  )rQ   rÞ  s     rT   rð  z$AsyncHybridQuery._blob_output_schema¤  s8   è ø€ Ü'¨¯©×(CÑ(CÓ(EÀtÇ{Á{ÓSˆØ!×/Ñ/Ó1×1Ð1Ð1ús   ‚AAÁA	ÁAc              ƒ  ó–  K  — t        | j                  j                  «       | j                  «      }t	        | j                  j                  «       | j                  «      }|j                  j                  «       }|j                  j                  «       }|j                  �|j                  n|j                  }|€t        }|j                  xs |j                  xs d}d| _
        t        j                  | j                  |j                  «      r^t        j                  j                  | j                  j!                  «       ƒ d{  –—† t#        |«      | j%                  «       ¬«      | _
        | j                  €!|j'                  «        |j'                  «        n]| j                  j)                  |j*                  «      }| j                  j,                  r"|j+                  |«       |j+                  |«       |j                  ||z   «       |j                  ||z   «       |j                  d«       |j                  d«       ||||fS 7 �Œ­w)a•  Build the sub-queries that make up this hybrid query.

        Execution, `explain_plan` and `analyze_plan` all go through here so that
        the plans that are reported are the plans that actually run.

        Returns the two sub-queries along with the effective limit and offset of
        the hybrid query itself. The key the legs are fused on, if any, is left
        on `self._pk_fusion`.
        Nr   rd  )r×  ro   Úto_fts_queryry   rÒ  r   rs  rº   rþ  r»   rÛ  r(   re  rb  rf  rg  rM   r¶   rã  r¸   rh  r´   Úinjected)rQ   rõ  Ú	vec_queryÚfts_reqÚvec_reqrº   r»   r¦   s           rT   Ú_create_child_queriesz&AsyncHybridQuery._create_child_queries¨  sÃ  è ø€ ô " $§+¡+×":Ñ":Ó"<¸d¿k¹kÓJˆ	Ü$ T§[¡[×%@Ñ%@Ó%BÀDÇKÁKÓPˆ	à×"Ñ"×3Ñ3Ó5ˆØ×"Ñ"×3Ñ3Ó5ˆð ")§¡Ð!:�—’ÀÇÁˆØˆ=Ü(ˆEØ—‘Ò6 7§>¡>Ò6°Qˆð ˆŒÜ×(Ñ(¨¯©°g·o±oÔFÜ)×2Ñ2×<Ñ<Ø—k‘k×(Ñ(Ó*×*Ü)¨'Ó2Ø(,×(CÑ(CÓ(Eð =ó ˆDŒOð
 �?‰?Ð"Ø×!Ñ!Ô#Ø×!Ñ!Õ#ð —o‘o×,Ñ,¨W¯^©^Ó<ˆGØ�‰×'Ò'Ø× Ñ  Ô)Ø× Ñ  Ô)ð 	�‰˜ ™Ô'Ø�‰˜ ™Ô'Ø×Ñ˜ÔØ×Ñ˜Ôà˜) U¨FÐ2Ð2ð5 +ûs   ‚EI	ÅIÅDI	r’  c             ƒ  ó–   ‡ ‡‡K  — t        j                  ˆˆ ˆfd„‰ j                  ˆ fd„‰ j                  «       ¬«      ƒ d {  –—† S 7 Œ­w)Nc                 ó*   •— ‰j                  ‰ ‰¬«      S r™  ræ  )r�  rQ   r°  s   €€€rT   rè  z3AsyncHybridQuery._execute_batches.<locals>.<lambda>í  s   ø€ �D×$Ñ$Ø!1¸7ð %ó € rW   c                 ó    •— ‰ j                   d uS rO   rê  rY   s   €rT   rè  z3AsyncHybridQuery._execute_batches.<locals>.<lambda>ñ  rë  rW   rì  )r(   Úwith_pk_fallback_asyncry   rã  r›  s   ```rT   r–  z!AsyncHybridQuery._execute_batcheså  sC   úè ø€ ô !×7Ñ7õð �K‰KÛ5Ø$(×$?Ñ$?Ó$Aô
÷ 
ð 	
ð 
ús   …=A	ÁAÁA	c          
   ƒ  ó¼  K  — | j                  «       ƒ d {  –—† \  }}}}|j                  j                  «       }d}d}	| j                  �j| j                  j	                  «       ƒ d {  –—† }
t        |«      }t        |
|| j                  ¬«      }|r#t        t        |
|«      j                  «       «      }	|| _        |	| _        t        j                  |j                  |¬«      |j                  |¬«      «      ƒ d {  –—† \  }}| j                   �| j                   j#                  ||«      \  }}t$        j'                  ||| j(                  |j+                  «       | j,                  |d|¬«      }| j                   �| j                   j/                  |«      }n2| j1                  «       s"|s d|j2                  v r|j5                  dg«      }t7        ||¬«      S 7 �Œ¾7 �Œp7 ŒÞ­w)	NFrP   r·   r²  Trñ  rç   ræ  )r  ro   rs  ry   rM   r¶   r,   rŸ  r©   r-   rû  ro  rp  ÚasyncioÚgatherr¸  rÛ  rü  r~  rý  rÚ  rà  rk  r  rã  rè   rê   r   )rQ   r�  r°  rõ  r  rº   r»   rµ   rú  ró   rM   r°   rò  ró  rû  s                  rT   rç  zAsyncHybridQuery._run_hybridõ  sË  è ø€ ð 59×4NÑ4NÓ4P×.PÑ+ˆ	�9˜e Và×Ñ×/Ñ/Ó1ˆØ ÐØ&(ˆ
Ø�;‰;Ð"ØŸ;™;×-Ñ-Ó/×/ˆFÜ2°3Ó7ˆJÜ8ØØØ ×-Ñ-ô Ðñ
  Ü"Ü.¨v°zÓB×GÑGÓIó�
ð "2ˆÔØ%ˆÔä,3¯N©NØ×Ñ wÐÓ/Ø×Ñ wÐÓ/ó-
÷ '
Ñ#ˆ�^ð �?‰?Ð&Ø*.¯/©/×*?Ñ*?Ø ó+Ñ'ˆN˜Kô )×@Ñ@Ø#Ø)Ø—‘Ø×)Ñ)Ó+Ø—^‘^ØØØð Aó 	
ˆð �?‰?Ð&Ø—_‘_×*Ñ*¨6Ó2‰Fà×+Ñ+Ô-Ù$Ø˜F×/Ñ/Ñ/à—[‘[ ( Ó,ˆFä% fÐ?OÔPÐPða /Qùð 0ùð'
ús6   ‚G–G—AGÁ'GÁ(BGÃ;GÃ<CGÇGÇGc              ƒ  ót  K  — | j                  «       ƒ d{  –—† \  }}}}|j                  |«      ƒ d{  –—† }|j                  |«      ƒ d{  –—† }dj                  d„ |j                  «       D «       «      }dj                  d„ |j                  «       D «       «      }| j                  › d|› d|› �S 7 Œ›7 Œ7 Œh­w)a8  Return the execution plan for this query.

        The output includes both the vector and FTS search plans.

        Examples
        --------
        >>> import asyncio
        >>> from lancedb import connect_async
        >>> from lancedb.index import FTS
        >>> async def doctest_example():
        ...     conn = await connect_async("./.lancedb")
        ...     table = await conn.create_table("my_table", [{"vector": [99.0, 99.0], "text": "hello world"}])
        ...     await table.create_index("text", config=FTS(with_position=False))
        ...     plan = await table.query().nearest_to([1.0, 2.0]).nearest_to_text("hello").explain_plan(True)
        ...     print(plan)
        >>> asyncio.run(doctest_example()) # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
        RRFReranker(K=60)
            ProjectionExec: expr=[vector@0 as vector, text@3 as text, _distance@2 as _distance, _rowid@1 as _rowid]
              LanceRead: uri=..., projection=[text], source=stream(_rowid)
                GlobalLimitExec: skip=0, fetch=10
                  FilterExec: _distance@2 IS NOT NULL
                    SortExec: TopK(fetch=1), expr=[_distance@2 ASC NULLS LAST, _rowid@1 ASC NULLS LAST], preserve_partitioning=[false]
                      KNNVectorDistance: metric=l2
                        LanceRead: uri=..., projection=[vector], num_fragments=..., ...
            ProjectionExec: expr=[vector@2 as vector, text@3 as text, _score@1 as _score, _rowid@0 as _rowid]
              LanceRead: uri=..., projection=[vector, text], source=stream(_rowid)
                GlobalLimitExec: skip=0, fetch=10
                  MatchQuery: column=text, query=[hello]

        Parameters
        ----------
        verbose : bool, default False
            Use a verbose output format.

        Returns
        -------
        plan : str
        NrO  c              3  ó&   K  — | ]	  }d |z   –— Œ y­wrQ  rP   rR  s     rT   r¤   z0AsyncHybridQuery.explain_plan.<locals>.<genexpr>Y  rT  rU  c              3  ó&   K  — | ]	  }d |z   –— Œ y­wrQ  rP   rR  s     rT   r¤   z0AsyncHybridQuery.explain_plan.<locals>.<genexpr>Z  rW  rU  rX  )r  r  rÉ   rY  rk  )	rQ   r  rõ  r  r¹  r[  r\  r]  r^  s	            rT   r  zAsyncHybridQuery.explain_plan-  s®   è ø€ ðP ,0×+EÑ+EÓ+G×%GÑ"ˆ	�9˜a Ø%×2Ñ2°7Ó;×;ˆØ"×/Ñ/°Ó8×8ˆàŸ)™)Ñ#U¸K×<RÑ<RÓ<TÔ#UÓUˆØ—y‘yÑ O¸×9LÑ9LÓ9NÔ OÓOˆØ—.‘.Ð!  oÐ%6°d¸<¸.ÐIÐIð &HøØ;øØ8ús2   ‚B8–B2—B8´B4µB8ÁB6ÁA%B8Â4B8Â6B8c              ƒ  ó:  K  — | j                  «       ƒ d{  –—† \  }}}}dg}|j                  |j                  |«      ƒ d{  –—† «       |j                  d«       |j                  |j                  |«      ƒ d{  –—† «       dj                  |«      S 7 Œ~7 ŒT7 Œ­w)uƒ  
        Execute the query and return the physical execution plan with runtime metrics.

        This runs both the vector and FTS (full-text search) queries and returns
        detailed metrics for each step of executionâ€”such as rows processed,
        elapsed time, I/O stats, and more. Itâ€™s useful for debugging and
        performance analysis.

        Parameters
        ----------
        distributed_metrics : Literal["aggregate", "per_worker", "full"]
            Defaults to "aggregate".
            How distributed worker metrics are displayed for remote query plans.

        Returns
        -------
        plan : str
        NzVector Search Query:zFTS Search Query:rO  )r  ra  r'  rÉ   )rQ   r$  rõ  r  r¹  rÌ  s         rT   r'  zAsyncHybridQuery.analyze_plan]  s�   è ø€ ð* ,0×+EÑ+EÓ+G×%GÑ"ˆ	�9˜a à)Ð*ˆØ�‰˜Y×3Ñ3Ð4GÓH×HÔIØ�‰Ð*Ô+Ø�‰˜Y×3Ñ3Ð4GÓH×HÔIà�y‰y˜Ó!Ð!ð &Høð IøàHús3   ‚B–B—+BÁBÁ8BÁ;BÁ<BÂBÂBrO   )rq  ÚLanceHybridQueryr{   r°  )r0  r   r@  r    r_   rã  rL  )r_   z4Tuple['AsyncFTSQuery', 'AsyncVectorQuery', int, int]r´  rS  r¶  rV  rW  )rb   rc   rd   r  r©  r    r1  rð  r  r–  rç  r  r'  r²  r³  s   @rT   rã  rã  q  sÄ   ø„ ñ	ö?ñ $/£=À7ðØ ðØ=@ðà	óó<2ð;3à	=ó;3ð@ +/Ø'+ñ	
ð (ð
ð %ð	
ð
 
 ó
ð& +/Ø'+ñ	6Qð (ð6Qð %ð	6Qð
 
 ó6Qôp.Jðb DOð"Ø#@ð"à	÷"rW   rã  c                  óD   ‡ — e Zd ZdZddˆ fd„Zdd„Z	 d	 	 	 	 	 dd„Zˆ xZS )	ÚAsyncTakeQueryú@
    Builder for parameterizing and executing take queries.
    c                ó&   •— t         ‰| �  ||«       y rO   rº  r»  s      €rT   r©  zAsyncTakeQuery.__init__�  s   ø€ Ü‰Ñ˜ Õ&rW   c                ó<   — | j                   j                  |«       | S )uÛ   Control RTE LSM read routing for this take query.

        ``False`` bypasses the RTE and reads the base table only â€” the escape
        hatch, since take-by-row-id/offset is not supported on the LSM scanner.
        rÅ  r  s     rT   rb  zAsyncTakeQuery.use_rte„  s   € ð 	�‰×Ñ˜FÔ#ØˆrW   c              ‹  ó   K  — y ­wrO   rP   )rQ   rR   rï   rS   s       rT   r¹  z$AsyncTakeQuery._plain_scan_to_pandas�  s   è ø€ ð ùs   ‚rO   )rq  ÚLanceTakeQueryr{   r°  )r  r�   r_   z'AsyncTakeQuery'r[  )rb   rc   rd   r  r©  rb  r¹  r²  r³  s   @rT   r  r  |  s8   ø„ ñö'óð /3ðàðð ,ðð
 
"÷rW   r  c                  ó  — e Zd ZdZdd„Zdd„Zdd„Zdd„Zdd„Zddd„Z	dd„Z
dd	„Zdd
„Zddddœ	 	 	 	 	 	 	 d d„Z	 d!ddœ	 	 	 	 	 d"d„Z	 d!ddœ	 	 	 	 	 d#d„Z	 	 d$ddœ	 	 	 	 	 	 	 d%d„Z	 d!	 	 	 d&d„Zd'd(d„Z	 d)	 	 	 d*d„Zy)+ÚBaseQueryBuilderzC
    Wraps AsyncQueryBase and provides a synchronous interface
    c                ó   — || _         y rO   )ro   )rQ   rq  s     rT   r©  zBaseQueryBuilder.__init__›  s	   € Øˆ�rW   c                ó6   — | j                   j                  «       S rO   )ro   r~   rY   s    rT   r~   z BaseQueryBuilder.to_query_objectž  s   € Ø�{‰{×*Ñ*Ó,Ð,rW   c                ó<   — | j                   j                  |«       | S )rz  )ro   r´   rÙ  s     rT   r´   zBaseQueryBuilder.select¡  s   € ð8 	�‰×Ñ˜7Ô#ØˆrW   c                ó:   — | j                   j                  «        | S )rˆ  )ro   r¸   rY   s    rT   r¸   zBaseQueryBuilder.with_row_idÀ  s   € ð 	�‰×ÑÔ!ØˆrW   c                ó<   — | j                   j                  |«       | S )zÙ
        Control RTE LSM read routing for this query.

        ``False`` bypasses the RTE and reads the base table only, the escape
        hatch for shapes the LSM scanner cannot honor (e.g. take-by-row-id).
        rÅ  r  s     rT   rb  zBaseQueryBuilder.use_rteÇ  s   € ð 	�‰×Ñ˜FÔ#ØˆrW   c                ó<   — | j                   j                  |«       | S rŠ  )ro   r‚   r  s     rT   r‚   z!BaseQueryBuilder.with_row_addressÑ  s   € ð 	�‰×$Ñ$Ð%5Ô6ØˆrW   c                ó<   — | j                   j                  |«       | S rŒ  )ro   r  r  s     rT   r  zBaseQueryBuilder.with_fragmentsØ  s   € ð 	�‰×"Ñ" 9Ô-ØˆrW   c                ó<   — | j                   j                  |«       | S rŽ  )ro   r€   r  s     rT   r€   zBaseQueryBuilder.fragment_idsß  s   € ð 	�‰× Ñ  Ô.ØˆrW   c                ó\   — t        j                  | j                  j                  «       «      S r”  )r   Úrunro   r´  rY   s    rT   r´  zBaseQueryBuilder.output_schemaæ  s    € ô �x‰x˜Ÿ™×1Ñ1Ó3Ó4Ð4rW   NrÑ   r�  c               óÎ   ‡— t        j                  | j                  j                  |||¬«      «      Šˆfd„}t        j
                  j                  ‰j                   |«       «      S )aS  
        Execute the query and return the results as an Apache Arrow RecordBatchReader.

        Parameters
        ----------

        max_batch_length: Optional[int]
            The maximum number of selected records in a single RecordBatch object.
            If not specified, a default batch length is used.
            It is possible for batches to be smaller than the provided length if the
            underlying data is stored in smaller chunks.
        timeout: Optional[timedelta]
            The maximum time to wait for the query to complete.
            If not specified, no timeout is applied. If the query does not
            complete within the specified time, an error will be raised.
        blob_mode: str, default "lazy"
            Controls blob conversion as described in
            :meth:`AsyncQueryBase.to_batches`.
        r�  c               3  óz   •K  — 	 	 t        j                  ‰ j                  «       «      –— Œ&# t        $ r Y y w xY w­wrO   )r   r&  Ú	__anext__ÚStopAsyncIteration)Úasync_readers   €rT   Ú	iter_syncz.BaseQueryBuilder.to_batches.<locals>.iter_sync  s=   øè ø€ ðØÜŸ(™( <×#9Ñ#9Ó#;Ó<Ò<ð øä%ò Ùðüs   ƒ;…', ¬	8µ;·8¸;)r   r&  ro   rÃ  rù   r
  r  rM   )rQ   r�  r°  rR   r,  r+  s        @rT   rÃ  zBaseQueryBuilder.to_batchesî  sY   ø€ ô4 —x‘xØ�K‰K×"Ñ"Ø!1¸7Èið #ó ó
ˆô	ô ×#Ñ#×0Ñ0°×1DÑ1DÁiÃkÓRÐRrW   rÍ  c               ób   — t        j                  | j                  j                  ||¬«      «      S )a{  
        Execute the query and collect the results into an Apache Arrow Table.

        This method will collect all results into memory before returning.  If
        you expect a large number of results, you may want to use
        [to_batches][lancedb.query.AsyncQueryBase.to_batches]

        Parameters
        ----------
        timeout: Optional[timedelta]
            The maximum time to wait for the query to complete.
            If not specified, no timeout is applied. If the query does not
            complete within the specified time, an error will be raised.
        blob_mode: str, default "lazy"
            ``"lazy"`` returns blob v2 descriptors that carry the row id
            ``fetch_blobs`` reads. ``"descriptions"`` returns them without it.
            ``"bytes"`` returns payload bytes and raises for legacy blob columns
            and blobs inside lists.
        rÍ  )r   r&  ro   r¸  r¿  s      rT   r¸  zBaseQueryBuilder.to_arrow  s'   € ô2 �x‰x˜Ÿ™×,Ñ,¨WÀ	Ð,ÓJÓKÐKrW   c               ób   — t        j                  | j                  j                  ||¬«      «      S )r£  rÍ  )r   r&  ro   rÅ  r¿  s      rT   rÅ  zBaseQueryBuilder.to_list2  s'   € ô, �x‰x˜Ÿ™×+Ñ+¨G¸yÐ+ÓIÓJÐJrW   c               óh   — t        j                   | j                  j                  ||fd|i|¤Ž«      S )a1  
        Execute the query and collect the results into a pandas DataFrame.

        This method will collect all results into memory before returning.  If you
        expect a large number of results, you may want to use
        [to_batches][lancedb.query.AsyncQueryBase.to_batches] and convert each batch to
        pandas separately.

        Examples
        --------

        >>> import asyncio
        >>> from lancedb import connect_async
        >>> async def doctest_example():
        ...     conn = await connect_async("./.lancedb")
        ...     table = await conn.create_table("my_table", data=[{"a": 1, "b": 2}])
        ...     async for batch in await table.query().to_batches():
        ...         batch_df = batch.to_pandas()
        >>> asyncio.run(doctest_example())

        Parameters
        ----------
        flatten: Optional[Union[int, bool]]
            If flatten is True, flatten all nested columns.
            If flatten is an integer, flatten the nested columns up to the
            specified depth.
            If unspecified, do not flatten the nested columns.
        timeout: Optional[timedelta]
            The maximum time to wait for the query to complete.
            If not specified, no timeout is applied. If the query does not
            complete within the specified time, an error will be raised.
        blob_mode: str, default "lazy"
            Passed through to :meth:`AsyncQueryBase.to_pandas`.
        **kwargs
            Forwarded to pyarrow.Table.to_pandas after query execution and
            optional flattening.
        rR   )r   r&  ro   rU   )rQ   rï   r°  rR   rS   s        rT   rU   zBaseQueryBuilder.to_pandasJ  s6   € ôZ �x‰xØ!ˆD�K‰K×!Ñ! '¨7ÑR¸iÐRÈ6ÑRó
ð 	
rW   c                ó^   — t        j                  | j                  j                  |«      «      S )rª  )r   r&  ro   rÒ  )rQ   r°  s     rT   rÒ  zBaseQueryBuilder.to_polars{  s#   € ô@ �x‰x˜Ÿ™×-Ñ-¨gÓ6Ó7Ð7rW   c                ó^   — t        j                  | j                  j                  |«      «      S )r­  )r   r&  ro   r  r  s     rT   r  zBaseQueryBuilder.explain_plan�  s"   € ô> �x‰x˜Ÿ™×0Ñ0°Ó9Ó:Ð:rW   c                ó^   — t        j                  | j                  j                  |«      «      S )r`  )r   r&  ro   r'  r&  s     rT   r'  zBaseQueryBuilder.analyze_plan¾  s#   € ô �x‰x˜Ÿ™×0Ñ0Ð1DÓEÓFÐFrW   )rq  rm  rI  r²  r³  rR  rE  rO  rP  rQ  rL  )r�  r4  r°  r>  rR   r5   r_   rA  rO   r?  rB  r°  rµ  rC  rS  r¶  rV  rW  )rb   rc   rd   r  r©  r~   r´   r¸   rb  r‚   r  r€   r´  rÃ  r¸  rÅ  rU   rÒ  r  r'  rP   rW   rT   r  r  –  s\  „ ñóó-óó>óôóóó5ð +/Ø'+Ø$ñ'Sð (ð'Sð %ð	'Sð
 ð'Sð 
ó'SðV (,ðLð %ñ	Là$ðLð ð	Lð
 
óLð: (,ðKð %ñ	Kà$ðKð ð	Kð
 
óKð4 /3Ø'+ð/
ð
 %ñ/
à+ð/
ð %ð/
ð
 ð/
ð 
ó/
ðf (,ð 8à$ð 8ð 
ó 8ôD;ðD DOðGØ#@ðGà	ôGrW   r  c                  ó$   ‡ — e Zd ZdZdˆ fd„Zˆ xZS )ÚLanceTakeQueryBuilderr  c                ó$   •— t         ‰| �  |«       y rO   rº  )rQ   rq  rn  s     €rT   r©  zLanceTakeQueryBuilder.__init__Õ  s   ø€ Ü‰Ñ˜ÕrW   )rq  r  )rb   rc   rd   r  r©  r²  r³  s   @rT   r4  r4  Ð  s   ø„ ñ÷ ñ  rW   r4  )rk   r    r_   rj   )rq   z'AsyncTable'rr   úIterable[str]r_   r�   )r_   rv   )r{   r
   r_   r�   )rƒ   r
   r_   r�   )r„   r:   r_   r�   )r‘   rV  r_   r1  )r–   rV  r—   rF  r_   rF  )r¦   r6   r_   úDict[str, Any])rµ   z'PyQueryRequest'r_   r6   rO   )
r„   r:   rR   r5   r¿   ra  r¸   rW  r_   r7  )r„   r:   r¿   ra  r_   ra  )rÕ   r<  rM   rM  rR   r5   r_   r<  )rÚ   rK   r_   ra   )rÚ   rK   rR   r5   r_   r`   )rÚ   rK   rR   r5   rì   rK  rí   r+   rî   r�   rï   r=  r_   r`   )
rã   ra   rR   r5   ró   r6  rï   r=  r_   r`   )rÚ   rK   rR   r5   rì   rK  rí   r*   rî   r�   rï   r=  r_   r`   )rû   r
   r_   z?Union[List[float], List[List[float]], pa.Array, List[pa.Array]])¦Ú
__future__r   r  Úabcr   r   Úconcurrent.futuresr   Údatetimer   Úenumr   Útypingr	   r
   r   r   r   r   r   r   r   r   r   r   r   r\  Únumpyr‚  Úpyarrowrù   Úpyarrow.computeÚcomputer  r?  Útyping_extensionsr   Úlancedb._lancedbr   Úlancedb.background_loopr   Ú r   Úarrowr   Údependenciesr   Úpdr¯   r   Úrerankers.baser   Úrerankers.rrfr    Úrerankers.utilr!   rM   r"   r#   r$   Úutilr%   r&   r'   r(   Ú_blobr)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   Útypesr5   r6   ÚsysÚPILrÎ  rÑ  Ú_lancedbr7   rè  r8   r  r9   r:   rÚ  r;   r  r<   rû  Úcommonr=   r>   r{   r?   r@   Úversion_inforC   rD   rX  r«   r©   r…  rú   r‡  r‘  rþ  rK   rl   rs   rw   r|   r…   rŒ   r’   rœ   r±   r¶   rÂ   r¾   r×   rÜ   rä   rð   rô   rö   rý   Ú	BaseModelrÿ   r    r  r  r  r  ÚdataclassesÚ	dataclassr   r0  rB  rF  rL  r&  rS  rq  rŠ  r�  r  r~  Úobjectrm  r¸  rÈ  r×  rê  rÒ  rã  r  r  r4  rP   rW   rT   ú<module>rX     sB  ðõ #ã ß #Ý 1Ý Ý ÷÷ ÷ õ ó  Û Û Ý Û Ý 'å .Ý (Ý Ý )Ý &Ý Ý $Ý &Ý 1ß PÑ Pß IÑ IÝ ÷÷ ÷ ó ÷ -áÛãÛå3Ý9Ý(Ý-Ý5Ý9ÝÝ$ß(à
×Ñ˜7Ò"Þå*áˆC�|Ô$€Ø 'Ð(IÑ JÐ Ø  %¨¯©°R·X±X¸r¿¹ÐOÐ ð Ð ð ô
�Hó 
ó ð
óðWØðWØ4AðWà	óWóó/ó
ó óð/Ø(ð/Ø/?ð/àó/ó*#ó2ð "ðNð
 #'ñNØðNàðNð ðNð
  ðNð óNó,ð0ØðØ )ðØ6>ðàóó"ð#Øð#Ø'/ð#àó#ð<Øðð ðð !ð	ð
  ðð ðð (ðð óð:Ø	ðð ðð ð	ð
 (ðð óð,Øðð ðð !ð	ð
 !ðð ðð (ðð óð<Ø	ðàDóô6�X×'Ò'ô ô˜˜Tô ô�s˜Dô ô
"˜#˜tô "ôˆC�ô ð 
×Ò×Òô=K�Có =Kó  ð=Kð@ 
×Ò×Òô1'�ó 1'ó  ð1'ðh 
×Ò×Òô.�-ó .ó  ð.ð: 
×Ò×Òô'�ó 'ó  ð'ð, 
×Ò×Òô-�mó -ó  ð-ð> 
×Ò×Òô)�=ó )ó  ð)ô$%˜(×,Ò,ô %ô$lEˆH×Òô lEô^Y"˜ô Y"ôxFÐ/ô FôRJÐ,ô JôZ<EÐ.ô <Eô~V+Ð/ô V+ôrL	C�Vô L	Cô^I˜ô IôXGYÐ#ô GYôThRÐ&ô hR÷VJñ JôZSRÐ)Ð+?ô SRôlH"Ð)Ð+?ô H"ôV�^ô ô4wG�vô wGôt	 Ð,õ  rW   