Re: Deleting from index via web

2007-07-12 Thread Mike Klaas

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 = ''+self.escapeVal(`id`)+''
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 = ''+ id + ''
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


Re: Deleting from index via web

2007-07-12 Thread vanderkerkoff

I/my boss and me worked it out.

The delete funtion in solr.py looks like this
def delete(self, id):
xstr = ''+self.escapeVal(`id`)+''
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 = ''+ id + ''
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

2007-07-12 Thread vanderkerkoff

ok, I'm now printing out the xstr variable that the delete in solr.py uses
when it's trying to delete.

it's coming out like this
'news:39'

Those quotes look suspicious

Going to work out how to switch more debugging on in solr now so I can see
what's going on exactly
-- 
View this message in context: 
http://www.nabble.com/Deleting-from-index-via-web-tf4066903.html#a11559119
Sent from the Solr - User mailing list archive at Nabble.com.



Re: Deleting from index via web

2007-07-12 Thread vanderkerkoff

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

2007-07-12 Thread vanderkerkoff

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.



Deleting from index via web

2007-07-12 Thread vanderkerkoff

Hello everyone

We're adding records to our 1.1 index through django and python like so,
using the jetty app.
This is in the save definition.

from solr import SolrConnection
c = SolrConnection(host='localhost:8983', persistent=False)
c.add(id=e_url,url_t=e_url,body_t=body4solr,title_t=title4solr,summary_t=summary4solr,contact_name_t=contactname4solr)
c.commit(optimize=True)

I need to write a script to remove the item from the index in the delete
function.  Do I need to create all the items like I do on the add or can I
just somehow say delete all the records where the id=e_url?

Something like 

from solr import SolrConnection
c = SolrConnection(host='localhost:8983', persistent=False)
c.delete(* where id=e_url)
c.commit(optimize=True)

Any help as always is greatly appreciated.


-- 
View this message in context: 
http://www.nabble.com/Deleting-from-index-via-web-tf4066903.html#a11556220
Sent from the Solr - User mailing list archive at Nabble.com.