Beispiel #1
0
    def delete_by_query(self, q, commit=True):

        results=[]
        
        results.append(self.update(
            unicode("\n<delete><query>%s</query></delete>\n" % q, "utf-8")
        ))
        if commit:
            results.append(self.commit())

        return results
Beispiel #2
0
 def add(self, xml, commit=True):
     """
     Adds the specified list of objects to the search index.  Returns a
     two-element List of UpdateResults; the first element corresponds to
     the add operation, the second to the subsequent commit operation.
     """
     
     if xml:
         xml = "\n<add>\n" + xml + "</add>\n"
     
     results=[]
     
     results.append(self._update_request("add", xml))
     
     if commit:
         results.append(self.commit())
     
     return results
Beispiel #3
0
 def delete(self, xml, commit=True):
     """
     Deletes the specified list of objects from the search index.  Returns
     a two-element List of UpdateResults; the first element corresponds to
     the delete operation, the second to the subsequent commit operation.
     """
     
     if xml:
         xml = "\n<delete>\n" + xml + "</delete>\n"
             
     results=[]
     
     results.append(self._update_request("delete", xml))
     
     if commit:
         results.append(self.commit())
     
     return results