views:

77

answers:

1

A little background:

  • I want to use Django Search with Lucene
  • I have Django 1.1 w/ Python 2.5 installed
  • MySQL 5.1 is being used
  • My local machine is running Windows Vista x64, but we will deploy to Red Hat Linux
  • Yes, I wish that right about now I was running Linux.
+3  A: 

I would recommend Apache SOLR, which is built on top of Lucene. The primary advantage is that it exposes an easy to use API, and can return a native Python object. Here is an example of how to call it from Python:

params = urllib.urlencode({        
    "rows": "100",       
    "fl": "id,name,score,address,city,state,zip",        
    "wt": "python",        
    "q": "+name:Foo +city:Boston"
})        

request = urllib2.urlopen(urllib2.Request("http://locahost:8983/solr/select", params))
response = ast.literal_eval(request.read())
request.close()            
return response["docs"]
Chase Seibert
Second the recommendation for Solr - there's even a Django project, Haystack, which provides integration with Django models.
Daniel Roseman
Thanks! I can't use Solr because our technology stack due to reasons unknown can't support Java.
mkelley33
Well, Solr's what we ended up going with anyway! Thanks!
mkelley33