File: //usr/lib/python3/dist-packages/boto/cloudsearch2/__pycache__/document.cpython-310.pyc
o
ckF[n- � @ s� d dl Zd dlmZ d dlZd dlZd dlmZ G dd� de�ZG dd� de�Z G dd � d e�Z
G d
d� de�ZG dd
� d
e�Z
G dd� de�ZdS )� N)�json)�CloudSearchDomainConnectionc @ s e Zd ZdS )�SearchServiceExceptionN)�__name__�
__module__�__qualname__� r r �</usr/lib/python3/dist-packages/boto/cloudsearch2/document.pyr s r c @ s e Zd ZdZdS )�CommitMismatchErrorN)r r r �errorsr r r r r
# s r
c @ � e Zd ZdZdS )�
EncodingErrorz�
Content sent for Cloud Search indexing was incorrectly encoded.
This usually happens when a document is marked as unicode but non-unicode
characters are present.
N�r r r �__doc__r r r r r
) s r
c @ r )�ContentTooLongErrorz�
Content sent for Cloud Search indexing was too long
This will usually happen when documents queued for indexing add up to more
than the limit allowed per upload batch (5MB)
Nr r r r r r 3 s r c @ sZ e Zd ZdZddd�Zdd� Zdd� Zd d
� Zdd� Zd
d� Z dd� Z
dd� Zdd� ZdS )�DocumentServiceConnectiona/
A CloudSearch document service.
The DocumentServiceConection is used to add, remove and update documents in
CloudSearch. Commands are uploaded to CloudSearch in SDF (Search Document
Format).
To generate an appropriate SDF, use :func:`add` to add or update documents,
as well as :func:`delete` to remove documents.
Once the set of documents is ready to be index, use :func:`commit` to send
the commands to CloudSearch.
If there are a lot of documents to index, it may be preferable to split the
generation of SDF data and the actual uploading into CloudSearch. Retrieve
the current SDF with :func:`get_sdf`. If this file is the uploaded into S3,
it can be retrieved back afterwards for upload into CloudSearch using
:func:`add_sdf_from_s3`.
The SDF is not cleared after a :func:`commit`. If you wish to continue
using the DocumentServiceConnection for another batch upload of commands,
you will need to :func:`clear_sdf` first to stop the previous batch of
commands from being uploaded again.
Nc C s� || _ || _| js
|j| _g | _d | _i | _d| _| j rO| j jrQ| j jjr.d| j j� � i| _t
| j jdd�| _| jrS| j j}t| j|j|j
|j|jd�| _d S d S d S d S )NF�http�sign_request)�host�aws_access_key_id�aws_secret_access_key�region�provider)�domain�endpoint�doc_service_endpoint�documents_batch�_sdf�proxyr �layer1� use_proxy�get_proxy_url_with_auth�getattrr r r r r �domain_connection)�selfr r r r r r �__init__Y s.
��z"DocumentServiceConnection.__init__c C s d||d�}| j �|� dS )aV
Add a document to be processed by the DocumentService
The document will not actually be added until :func:`commit` is called
:type _id: string
:param _id: A unique ID used to refer to this document.
:type fields: dict
:param fields: A dictionary of key-value pairs to be uploaded .
�add)�type�id�fieldsN�r �append)r$ �_idr) �dr r r r&