o
    ›¨Êh�  ã                   @   s8   d dl mZ d dlmZ ddlmZ G dd„ deƒZdS )é    )Úcall_command)ÚBaseCommandé   )ÚDEFAULT_MAX_RETRIESc                   @   s    e Zd ZdZdd„ Zdd„ ZdS )ÚCommandzPCompletely rebuilds the search index by removing the old data and then updating.c              	   C   s€   |j dddddd� |j ddd	g d
d� |j dddtdd� |j dddddd� |j dddtdd� |j ddddttdd� d S )Nz	--noinputÚstore_falseÚinteractiveTzRIf provided, no prompts will be issued to the user and the data will be wiped out.)ÚactionÚdestÚdefaultÚhelpz-uz--usingÚappendzdUpdate only the named backend (can be used multiple times). By default all backends will be updated.)r	   r   r   z-kz	--workersr   zVAllows for the use multiple workers to parallelize indexing. Requires multiprocessing.)r   Útyper   z
--nocommitÚcommitz&Will pass commit=False to the backend.z-bz--batch-sizeÚ	batchsizez!Number of items to index at once.)r
   r   r   z-tz--max-retriesÚstoreÚmax_retrieszHMaximum number of attempts to write to the backend when an error occurs.)r	   r
   r   r   r   )Úadd_argumentÚintr   )ÚselfÚparser© r   ú\/var/www/html/env/lib/python3.10/site-packages/haystack/management/commands/rebuild_index.pyÚadd_arguments
   sX   ûûûûû
ùzCommand.add_argumentsc                 K   sP   |  ¡ }|  ¡ }dD ]}||= q
dD ]}||= qtdi |¤Ž tdi |¤Ž d S )N)r   Úworkersr   )r   Úclear_indexÚupdate_index)r   )r   )Úcopyr   )r   ÚoptionsÚclear_optionsÚupdate_optionsÚkeyr   r   r   Úhandle9   s   zCommand.handleN)Ú__name__Ú
__module__Ú__qualname__r   r   r"   r   r   r   r   r      s    /r   N)Údjango.core.managementr   Údjango.core.management.baser   r   r   r   r   r   r   r   Ú<module>   s    