On 7/26/06, sangraal aiken <[EMAIL PROTECTED]> wrote:
I removed everything from the Add xml so the docs looked like this:

<doc>
<field name="id">187880</field>
</doc>
<doc>
<field name="id">187852</field>
</doc>

and it still hung at 6,144...

Maybe you can try the following simple Python client to try and rule
out some kind of different client interactions... the attached script
adds 10,000 documents and works fine for me in WinXP w/ Tomcat 5.5.17
and Jetty

-Yonik


------------------------------------ solr.py ----------------------
import httplib
import socket

class SolrConnection:
 def __init__(self, host='localhost:8983', solrBase='/solr'):
   self.host = host
   self.solrBase = solrBase
   #a connection to the server is not opened at this point.
   self.conn = httplib.HTTPConnection(self.host)
   #self.conn.set_debuglevel(1000000)
   self.postheaders = {"Connection":"close"}

 def doUpdateXML(self, request):
   try:
     self.conn.request('POST', self.solrBase+'/update', request,
self.postheaders)
   except (socket.error,httplib.CannotSendRequest) :
     #reconnect in case the connection was broken from the server going down,
     #the server timing out our persistent connection, or another
     #network failure.
     #Also catch httplib.CannotSendRequest because the HTTPConnection object
     #can get in a bad state.
     self.conn.close()
     self.conn.connect()
     self.conn.request('POST', self.solrBase+'/update', request,
self.postheaders)

   rsp = self.conn.getresponse()
   #print rsp.status, rsp.reason
   data = rsp.read()
   #print "data=",data
   self.conn.close()

 def delete(self, id):
   xstr = '<delete><id>'+id+'</id></delete>'
   self.doUpdateXML(xstr)

 def add(self, **fields):
   #todo: XML escaping
   flist=['<field name="%s">%s</field>' % f for f in fields.items() ]
   flist.insert(0,'<add><doc>')
   flist.append('</doc></add>')
   xstr = ''.join(flist)
   self.doUpdateXML(xstr)

c = SolrConnection()
#for i in range(10000):
#  c.delete(str(i))
for i in range(10000):
 c.add(id=i)

Reply via email to