
    [g+                     N    S SK Jr   " S S\5      r " S S5      r " S S5      rg)	    )Enumc                   $    \ rS rSrSrSrSrSrSrg)QueryPresence   zBDefines possible behaviours for the term's presence in a document.          N)	__name__
__module____qualname____firstlineno____doc__OPTIONALREQUIRED
PROHIBITED__static_attributes__r
       ,/usr/lib/python3/dist-packages/lunr/query.pyr   r      s    LHHJr   r   c                   F    \ rS rSrSrSrSrSrSrS r	S r
S	 rS
 rS rSrg)Query   zA `lunr.Query` provides a programmatic way of defining queries to be
performed against a `lunr.Index`.

Prefer constructing a `lunr.Query` using `the lunr.Index.query` method
so the query object is pre-initialized with the right index fields.
*r   r   r   c                     / U l         Xl        g N)clauses
all_fields)selfr   s     r   __init__Query.__init__   s    $r   c                     SR                  SR                  U R                  5      SR                  S U R                   5       5      5      $ )Nz <Query fields="{}" clauses="{}">,c              3   8   #    U  H  oR                   v   M     g 7fr   )term).0cs     r   	<genexpr>!Query.__repr__.<locals>.<genexpr>%   s     /M1s   )formatjoinr   r   r   s    r   __repr__Query.__repr__#   s:    188HHT__%sxx/M/M'M
 	
r   c                 t   U(       a  [        US   [        5      (       a  US   nO[        U0 UD6nUR                  (       d  U R                  Ul        UR                  [
        R                  -  (       aC  UR                  S   [
        R                  :w  a"  [
        R                  UR                  -   Ul        UR                  [
        R                  -  (       aC  UR                  S   [
        R                  :w  a"  UR                  [
        R                  -   Ul        U R                  R                  U5        U $ )a_  Adds a `lunr.Clause` to this query.

Unless the clause contains the fields to be matched all fields will be
matched. In addition a default boost of 1 is applied to the clause.

If the first argument is a `lunr.Clause` it will be mutated and added,
otherwise args and kwargs will be used in the constructor.

Returns:
    lunr.Query: The Query itself.
r   )
isinstanceClausefieldsr   wildcardr   WILDCARD_LEADINGr$   WILDCARDWILDCARD_TRAILINGr   append)r   argskwargsclauses       r   r:   Query.clause(   s     JtAw//!WFT,V,F}} OOFMOOe444KKNenn,..6;;6FKOOe555KKOu~~- ++6FKF#r   c                     [        U[        [        45      (       a  U H  nU R                  " U40 UD6  M     U $ U R                  " [        U5      40 UD6  U $ )a  Adds a term to the current query, creating a Clause and adds it to
the list of clauses making up this Query.

The term is not tokenized and used "as is". Any conversion to token
or token-like strings should be performed before calling this method.

For example:
    query.term(lunr.Tokenizer("foo bar"))

Args:
    term (Token or iterable): Token or iterable of tokens to add.
    kwargs (dict): Additional properties to add to the Clause.
)r0   listtupler$   r:   str)r   r$   r9   ts       r   r$   
Query.termI   sS     dT5M**		!&v& 
  KKD	,V,r   c                 :    [        S U R                   5       5      $ )zA negated query is one in which every clause has a presence of
prohibited. These queries require some special processing to return
the expected results.
c              3   Z   #    U  H!  oR                   [        R                  :H  v   M#     g 7fr   )presencer   r   )r%   r:   s     r   r'   #Query.is_negated.<locals>.<genexpr>d   s       
FRFOO}777ls   )+)allr   r+   s    r   
is_negatedQuery.is_negated_   s"    
  
FJll
 
 	
r   )r   r   N)r   r   r   r   r   r5   WILDCARD_NONEr4   r6   r   r,   r:   r$   rG   r   r
   r   r   r   r      s9     HM%

B,
r   r   c                   l   ^  \ rS rSrSrSSSSS\R                  \R                  4U 4S jjr	S r
S	rU =r$ )
r1   i   a.  A single clause in a `lunr.Query` contains a term and details on
how to match that term against a `lunr.Index`

Args:
    term (str, optional): The term for the clause.
    field (iterable, optional): The fields for the term to be searched
        against.
    edit_distance (int, optional): The character distance to use, defaults
        to 0.
    use_pipeline (bool, optional): Whether the clause should be pre
        processed by the index's pipeline, default to True.
    boost (int, optional): Boost to apply to the clause, defaults to 1.
    wildcard (Query.WILDCARD_*, optional): Any of the Query.WILDCARD
        constants defining if a wildcard is to be used and how, defaults
        to Query.WILDCARD_NONE.
    presence (QueryPresence, optional): Behaviour for a terms presence
        in a document.
Nr   Tr   c                    > [         TU ]  5         Xl        U=(       d    / U l        X0l        X@l        XPl        X`l        Xpl        g r   )	superr   r$   r2   edit_distanceuse_pipelineboostr3   rD   )	r   r$   r2   rN   rO   rP   r3   rD   	__class__s	           r   r   Clause.__init__}   s;     		l*(
  r   c                 8    SR                  U R                  5      $ )Nz<Clause term="{}">)r)   r$   r+   s    r   r,   Clause.__repr__   s    #**49955r   )rP   rN   r2   rD   r$   rO   r3   )r   r   r   r   r   r   rI   r   r   r   r,   r   __classcell__)rQ   s   @r   r1   r1   i   s:    * $$''!&6 6r   r1   N)enumr   r   r   r1   r
   r   r   <module>rW      s+    D Z
 Z
z(6 (6r   