
    Nwg                     2    d dl mZ d dlmZ  G d de      Zy)    )BaseCommand)connectionsc                       e Zd ZdZd Zd Zy)Command'Clears out the search index completely.c                     |j                  ddddd       |j                  ddd	g d
       |j                  ddddd       y )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
--nocommitcommitz&Will pass commit=False to the backend.)add_argument)selfparsers     _/var/www/horilla/myenv/lib/python3.12/site-packages/haystack/management/commands/clear_index.pyadd_argumentszCommand.add_arguments	   sn     e 	 	
 	7 	 	
 	 9 	 	
    c                 2   t        |j                  dd            | _        |j                  dd      | _        |j                  d      }|st        j
                  j                         }|j                  dd      r| j                  j                  ddj                  |      z         | j                  j                  d	       t        d
      }|j                         j                  d      s| j                  j                  d       y| j                  dk\  r| j                  j                  d       |D ]5  }t        |   j                         }|j                  | j                         7 | j                  dk\  r| j                  j                  d       yy)r   	verbosity   r   Tusingr
   z[WARNING: This will irreparably remove EVERYTHING from your search index in connection '%s'.z', 'z_Your choices after this are to restore from backups or rebuild via the `rebuild_index` command.z)Are you sure you wish to continue? [y/N] yzNo action taken.Nz;Removing all documents from your index because you said so.)r   zAll documents removed.)intgetr   r   r   connections_infokeysstdoutwritejoininputlower
startswithget_backendclear)r   optionsr   	yes_or_nobackend_namebackends         r   handlezCommand.handle!   sP   W[[a89kk(D1G$00557E;;}d+KKm++e$% KKq IJI??$//4!!"45>>QKKM " 	.L!,/;;=GMMM-	. >>QKK67 r   N)__name__
__module____qualname__r   r   r,    r   r   r   r      s    4D
0"8r   r   N)django.core.management.baser   haystackr   r   r0   r   r   <module>r3      s    3  =8k =8r   