@@ -426,7 +426,7 @@ def _suggest_terms(self, params):
426
426
path = 'terms/?%s' % safe_urlencode (params , True )
427
427
return self ._send_request ('get' , path )
428
428
429
- def _update (self , message , clean_ctrl_chars = True , commit = True , softCommit = False , waitFlush = None , waitSearcher = None ):
429
+ def _update (self , message , clean_ctrl_chars = True , commit = True , softCommit = False , waitFlush = None , waitSearcher = None , overwrite = None ):
430
430
"""
431
431
Posts the given xml message to http://<self.url>/update and
432
432
returns the result.
@@ -451,6 +451,9 @@ def _update(self, message, clean_ctrl_chars=True, commit=True, softCommit=False,
451
451
if waitFlush is not None :
452
452
query_vars .append ('waitFlush=%s' % str (bool (waitFlush )).lower ())
453
453
454
+ if overwrite is not None :
455
+ query_vars .append ('overwrite=%s' % str (bool (overwrite )).lower ())
456
+
454
457
if waitSearcher is not None :
455
458
query_vars .append ('waitSearcher=%s' % str (bool (waitSearcher )).lower ())
456
459
@@ -810,7 +813,7 @@ def _build_doc(self, doc, boost=None, fieldUpdates=None):
810
813
811
814
return doc_elem
812
815
813
- def add (self , docs , boost = None , fieldUpdates = None , commit = True , softCommit = False , commitWithin = None , waitFlush = None , waitSearcher = None ):
816
+ def add (self , docs , boost = None , fieldUpdates = None , commit = True , softCommit = False , commitWithin = None , waitFlush = None , waitSearcher = None , overwrite = None ):
814
817
"""
815
818
Adds or updates documents.
816
819
@@ -831,6 +834,8 @@ def add(self, docs, boost=None, fieldUpdates=None, commit=True, softCommit=False
831
834
832
835
Optionally accepts ``waitSearcher``. Default is ``None``.
833
836
837
+ Optionally accepts ``overwrite``. Default is ``None``.
838
+
834
839
Usage::
835
840
836
841
solr.add([
@@ -861,7 +866,7 @@ def add(self, docs, boost=None, fieldUpdates=None, commit=True, softCommit=False
861
866
862
867
end_time = time .time ()
863
868
self .log .debug ("Built add request of %s docs in %0.2f seconds." , len (message ), end_time - start_time )
864
- return self ._update (m , commit = commit , softCommit = softCommit , waitFlush = waitFlush , waitSearcher = waitSearcher )
869
+ return self ._update (m , commit = commit , softCommit = softCommit , waitFlush = waitFlush , waitSearcher = waitSearcher , overwrite = overwrite )
865
870
866
871
def delete (self , id = None , q = None , commit = True , waitFlush = None , waitSearcher = None ):
867
872
"""
@@ -1167,11 +1172,10 @@ def _send_request(self, method, path='', body=None, headers=None, files=None):
1167
1172
time .sleep (self .retry_timeout ) # give zookeeper time to notice
1168
1173
return self ._randomized_request (method , path , body , headers , files )
1169
1174
1170
- def _update (self , message , clean_ctrl_chars = True , commit = True , softCommit = False , waitFlush = None ,
1171
- waitSearcher = None ):
1175
+ def _update (self , * args , ** kwargs ):
1172
1176
self .url = self .zookeeper .getLeaderURL (self .collection )
1173
1177
LOG .debug ('Using random leader URL: %s' , self .url )
1174
- return Solr ._update (self , message , clean_ctrl_chars , commit , softCommit , waitFlush , waitSearcher )
1178
+ return Solr ._update (self , * args , ** kwargs )
1175
1179
1176
1180
1177
1181
class ZooKeeper (object ):
0 commit comments