Re: Deleting from index via web
Done some more digging about this here's my delete code def delete(self): from solr import SolrConnection c = SolrConnection(host='localhost:8983', persistent=False) e_url = '/news/' + self.created_at.strftime(%Y/%m/%d) + '/' + self.slug e_url = e_url.encode('ascii','ignore') c.delete(id=e_url) c.commit(optimize=True) I get this back from jetty INFO: delete(id '/news/2007/07/12/pilly') 0 1 It's not deleting the record form the index though, even if I restart jetty. I'm wondering if I can use URL's as ID's now. -- View this message in context: http://www.nabble.com/Deleting-from-index-via-web-tf4066903.html#a11558048 Sent from the Solr - User mailing list archive at Nabble.com.
Re: Deleting from index via web
Different tactic now adding like this idstring = news:%s; % self.id c.add(id=idstring,url_t=e_url,body_t=body4solr,title_t=title4solr,summary_t=summary4solr,contact_name_t=contactname4solr) c.commit(optimize=True) Goes in fine, search results show an ID of news:36 Delete like this delidstring = news:%s; % self.id c.delete(id=delidstring) c.commit(optimize=True) still no joy -- View this message in context: http://www.nabble.com/Deleting-from-index-via-web-tf4066903.html#a11559113 Sent from the Solr - User mailing list archive at Nabble.com.
Re: Deleting from index via web
I/my boss and me worked it out. The delete funtion in solr.py looks like this def delete(self, id): xstr = 'deleteid'+self.escapeVal(`id`)+'/id/delete' return self.doUpdateXML(xstr) As we're not passing an integer it get's all c*nty booby, technical term. So if I rewrite the delete to be like this def delete(self, id): xstr = 'deleteid'+ id + '/id/delete' print xstr return self.doUpdateXML(xstr) It works fine. There's no need for escapeVal, as I know the words I'll be sending prior to the ID, in fact, I'm not sure why escapeVal is in there at all if you can't send it non integer values. Maybe someone can enlighten us. -- View this message in context: http://www.nabble.com/Deleting-from-index-via-web-tf4066903.html#a11560068 Sent from the Solr - User mailing list archive at Nabble.com.
Re: Deleting from index via web
On 12-Jul-07, at 6:33 AM, vanderkerkoff wrote: I/my boss and me worked it out. The delete funtion in solr.py looks like this def delete(self, id): xstr = 'deleteid'+self.escapeVal(`id`)+'/id/delete' return self.doUpdateXML(xstr) As we're not passing an integer it get's all c*nty booby, technical term. So if I rewrite the delete to be like this def delete(self, id): xstr = 'deleteid'+ id + '/id/delete' print xstr return self.doUpdateXML(xstr) It works fine. There's no need for escapeVal, as I know the words I'll be sending prior to the ID, in fact, I'm not sure why escapeVal is in there at all if you can't send it non integer values. Maybe someone can enlighten us. I would suggest replacing it with self.escapeVal(unicode(id)) backticks are equivalent to repr(), which does the wrong thing for strings. -Mike