Help with query syntax
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.
Re: Help with query syntax
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.
Re: LockObtainFailedException
quick fix look for a lucene lock file in your tmp directory and delete it, then restart solr, should start I am an idiot though, so be careful, in fact, I'm worse than an idiot, I know a little :-) you got a lock file somewhere though, deleting that will help you out, for me it was in my /tmp directory On 27 Sep 2007, at 14:10, Jae Joo wrote: will anyone help me why and how? org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: SimpleFSLock@/usr/local/se archengine/apache-solr-1.2.0/fr_companies/solr/data/index/write.lock at org.apache.lucene.store.Lock.obtain(Lock.java:70) at org.apache.lucene.index.IndexWriter.init (IndexWriter.java:579) at org.apache.lucene.index.IndexWriter.(IndexWriter.java :341) at org.apache.solr.update.SolrIndexWriter. ( SolrIndexWriter.java:65) at org.apache.solr.update.UpdateHandler.createMainIndexWriter( UpdateHandler.java:120) at org.apache.solr.update.DirectUpdateHandler2.openWriter( DirectUpdateHandler2.java:181) at org.apache.solr.update.DirectUpdateHandler2.addDoc( DirectUpdateHandler2.java:259) at org.apache.solr.handler.XmlUpdateRequestHandler.update( XmlUpdateRequestHandler.java:166) at org.apache.solr.handler.XmlUpdateRequestHandler.handleRequestBody (XmlUpdateRequestHandler .java:84) Thanks, Jae Joo
Re: Lock obtain timed out
I think you do this if you only have one index true Check with cleverer bods first though On 18 Oct 2007, at 16:11, Brian Whitman wrote: false
Re: quick question
I think I remembered Was it localhost in the jetty.xml addlistener section? On 18 Feb 2008, at 14:44, matt davies wrote: Hello everyone I've forgotten where I stipulated in my solr that the solr admin back end was only viewable from localhost. Can anyone point me in the right direction? thanks
quick question
Hello everyone I've forgotten where I stipulated in my solr that the solr admin back end was only viewable from localhost. Can anyone point me in the right direction? thanks
Re: How do I secure solr server?
Hi Mel One method is to limit the access to the web backend by only having it respond to 127.0.0.1. I'm not certain here but i think do that you need to add the limiting access code in your servlet, which may be different. For instance, we edited jetty.xml in our situation. I hope this is of some help to get you started looking, I've probably got alot of terminology incorrect there, and some facts :-) Might help though. matt On 21 Feb 2008, at 06:46, Mel Brand wrote: Hi guys, I run solr on a separate server from the application server and I'd like to know how to protect it. I'd like to know how to prevent someone from communicating to the server and also prevent unauthorized access (through the web) to admin page. Any help is extremely appreciated!! :) Thanks, Mel