| Server IP : 54.37.205.81 / Your IP : 216.73.216.76 Web Server : nginx/1.22.1 System : Linux vps-249481fa 6.1.0-50-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.176-1 (2026-07-02) x86_64 User : debian ( 1000) PHP Version : 8.2.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /usr/lib/python3/dist-packages/lunr/__pycache__/ |
Upload File : |
�
WIb�= � �� � d dl mZ d dlZd dlZd dlmZ d dlmZ d dlm Z d dl
mZ d dlm
Z
d dlmZ d d lmZmZ d d
lmZ d dlmZ d dlmZ ej e� � Z G d
� d� � ZdS )� )�defaultdictN)�BaseLunrException)�FieldRef)� MatchData)�TokenSet)�TokenSetBuilder)�Pipeline)�Query�
QueryPresence)�QueryParser)�CompleteSet��Vectorc �P � e Zd ZdZd� Zd� Zd� Zd
d�Zdd�Zd� Z e
d � � � ZdS )�IndexaV An index contains the built index of all documents and provides a query
interface to the index.
Usually instances of lunr.Index will not be created using this
constructor, instead lunr.Builder should be used to construct new
indexes, or lunr.Index.load should be used to load previously built and
serialized indexes.
c �L � || _ || _ || _ || _ || _ d S �N)�inverted_index�
field_vectors� token_set�fields�pipeline)�selfr r r r r s �,/usr/lib/python3/dist-packages/lunr/index.py�__init__zIndex.__init__ s+ � �,���*���"������ ��
�
�
� c �B � | j |j k o| j |j k S r )r r )r �others r �__eq__zIndex.__eq__$ s% � �
��5�#7�7�W�D�K�5�<�<W�
r c � � | � � � }t ||� � }|� � � | � |� � S )a� Performs a search against the index using lunr query syntax.
Results will be returned sorted by their score, the most relevant
results will be returned first.
For more programmatic querying use `lunr.Index.query`.
Args:
query_string (str): A string to parse into a Query.
Returns:
dict: Results of executing the query.
)�create_queryr �parse�query)r �query_stringr# �parsers r �searchzIndex.search* sC � � �!�!�#�#���\�5�1�1���������z�z�%� � � r Nc � � |�t | j � � S t |� � t | j � � z
}|rt d|� � �t |� � S )a7 Convenience method to create a Query with the Index's fields.
Args:
fields (iterable, optional): The fields to include in the Query,
defaults to the Index's `all_fields`.
Returns:
Query: With the specified fields or all the fields in the Index.
Nz#Fields {} are not part of the index)r
r �setr )r r �non_contained_fieldss r r! zIndex.create_query>