I've worked it out. colons, not = signs :-)

if request.has_key('q'):
                z = request['q']
                the_url = request.META['PATH_INFO'].split('/')
                cat_type = the_url[3]
                print cat_type
gog = 'id: ' + cat_type + '* AND (title_t:"' + z + '"' + ' OR body_t:"' + z + '"' + ' OR url_t:"' + z + '"' + ' OR contact_name_t:"' + z + '"' gog += ' OR keywords_t:"' + z + '"' + ' OR metadescription_t:"' + z + '"' + ' OR presenter_name_t:"' + z + '"'
                gog +=  ' OR summary_t:"' + z + '"' + ' OR venue_t:"' + z + '")'
                s = SolrConnection(host='localhost:8983', persistent=False)
                data = s.search(q=gog, rows='100', wt='python')

Works really well



On 6 Aug 2007, at 11:00, matt davies wrote:

Hello everyone

I'm using solr1.1 and more or less the example app that comes with the nightly build.

I'm trying to do a search that says

give me all the results where id=news* and any of the other fields in the index that contain the search term form the form.

I've created ID's that contain the items type, so I've got news:23, documents:45 etc etc. We want to now search on a particular type.

I'm trying something like this at the moment, just to get a result back from one of the other fields in the index.

if request.has_key('q'):
                z = request['q']
                gog = "id=news* title_t=" + z
                print gog
                s = SolrConnection(host='localhost:8983', persistent=False)
                data = s.search(q=gog,rows='100', wt='python')

Can't get it to return any results though.

I've got Luke and I can see the field names are correct, I think I must be getting the syntax wrong.

Any help will be greatly appreciated.

Reply via email to