How to use AND as opposed to OR as the default query operator.
Hi Everybody, I simply want to use AND as the default operator in queries. When a user searches for Jennifer Lopez solr converts this to a Jennifer OR Lopez query. On the other hand I want solr to treat this query as Jennifer AND Lopez and not as Jennifer OR Lopez. In other words I want a default AND behavior in phrase queries instead of OR. I have seen in this presentation http://www.slideshare.net/pittaya/using-apache-solr on Slide number 52 that this OR behavior is configurable. Could you please tell me where this configuration is located? I could not locate it in schema.xml. Swapnonil Mukherjee +91-40092712 +91-9007131999
Re: How to use AND as opposed to OR as the default query operator.
Hi Pradeep, I am using the standard query parser. I made the changes in schema.xml and it works. It is also good to know that this can done on a per query basis as well. Swapnonil Mukherjee On 25-Oct-2010, at 7:48 PM, Pradeep Singh wrote: > Which query handler are you using? For a standard query handler you can set > q.op per request or set defaultOperator in schema.xml. > > For a dismax handler you will have to work with min should match. > > On Mon, Oct 25, 2010 at 6:41 AM, Swapnonil Mukherjee < > swapnonil.mukher...@gettyimages.com> wrote: > >> Hi Everybody, >> >> I simply want to use AND as the default operator in queries. When a user >> searches for Jennifer Lopez solr converts this to a Jennifer OR Lopez query. >> On the other hand I want solr to treat this query as Jennifer AND Lopez and >> not as Jennifer OR Lopez. >> >> In other words I want a default AND behavior in phrase queries instead of >> OR. >> >> I have seen in this presentation >> http://www.slideshare.net/pittaya/using-apache-solr on Slide number 52 >> that this OR behavior is configurable. >> >> Could you please tell me where this configuration is located? I could not >> locate it in schema.xml. >> >> Swapnonil Mukherjee >> +91-40092712 >> +91-9007131999 >> >> >> >>
Does Solr reload schema.xml dynamically?
Hi Everybody, If I change my schema.xml to, do I have to restart Solr. Is there some way, I can apply the changes to schema.xml without restarting Solr? Swapnonil Mukherjee
Query only a specfic field with a specific value using Dismax Handler
Hi Everybody, Let me give you a brief idea of our Solr document. We have about 6 text type fields, each containing IPTC data extracted from photos. Search is performed mostly on these 6 fields. We also have a mutlivalue field named group_id that contains a list of all the group_ids that have access to this photo. In other words we are storing the metadata of the photo as well as the permissions applicable for this photo in the Solr document itself. This group_id field by the way is of long type. Additionally we have certain boolean and constant type fields named visibleToEndUser (boolean) and entityType (a java enum between 0 to 5). The first field defaultSearch is a copyField which contains a copy of all the values of 6 text type fields that I have mentioned. The way we query presently using the default search handler is like this. defaultSearch:(Dog) AND (group_id:2181347 OR group_id:2181364 OR group_id:2216624 OR group_id:2216990) AND (entityType:0) AND (visibleToEndUser:true) We want to start using the dismax (if not dismax then edismax) query handler but so far I have not been able to replicate the query mentioned above to the equivalent dismax form. What I cannot figure out is? 1. How do I apply exact match on the group_id, visibleToEndUser and the entityType fields? Or How how do I query a specific field with a specific value rather than searching across all fields with all values. 2. How do I apply OR and AND conditions? Swapnonil Mukherjee
Re: Does Solr reload schema.xml dynamically?
Hi Everybody, Thanks Ephraim and Peter. I think I got my answer. Swapnonil Mukherjee On 26-Oct-2010, at 4:23 PM, Ephraim Ofir wrote: > Note that usually when you change the schema.xml you have not only to > restart solr, but also rebuild the index, so the issue of how to reload > the file seems like a small problem... > > Ephraim Ofir > > -Original Message- > From: Peter Karich [mailto:peat...@yahoo.de] > Sent: Tuesday, October 26, 2010 12:29 PM > To: solr-user@lucene.apache.org > Subject: Re: Does Solr reload schema.xml dynamically? > > Hi, > > See this: > http://wiki.apache.org/solr/CoreAdmin#RELOAD > > Solr will also load the new configuration (without restart the webapp) > on the slaves when using replication: > http://wiki.apache.org/solr/SolrReplication > > Regards, > Peter. > >> Hi Everybody, >> >> If I change my schema.xml to, do I have to restart Solr. Is there some > way, I can apply the changes to schema.xml without restarting Solr? >> >> Swapnonil Mukherjee >> >> >> >> > > > -- > http://jetwick.com twitter search prototype >
Re: Query only a specfic field with a specific value using Dismax Handler
Thanks Jonathan. FQ seems promising. I will give it a go. Swapnonil Mukherjee On 26-Oct-2010, at 7:29 PM, Jonathan Rochkind wrote: > So, first of all, "exact" match is hard in Solr on tokenized fields. > Tokenized fields don't really do that. So for exact match, you should > probably use a non-tokenized field (string or text with keywordtokenizer > (which should really be called the non-tokenizer)). If there's only one > token in your value anyway though, like a single number, it may not > matter and work fine. > > Secondly, I'd recommend combining a dismax query for the user-entered > phrase (like 'dog') with standard lucene queries for those other > things. There are (at least) two ways to do that. The first is just put > everything after the first AND in one or more 'fq' parameters instead of > trying to include them in 'q'. The second is to use Solr's nested query > syntax, to specify sub-queries with different query parsers. Someone can > explain the second if you need it, but the easier to understand 'fq' > approach seems right to me for your case. > > Swapnonil Mukherjee wrote: >> Hi Everybody, >> >> Let me give you a brief idea of our Solr document. We have about 6 text type >> fields, each containing IPTC data extracted from photos. Search is performed >> mostly on these 6 fields. >> We also have a mutlivalue field named group_id that contains a list of all >> the group_ids that have access to this photo. In other words we are >> storing the metadata of the photo as well as the permissions applicable for >> this photo in the Solr document itself. This group_id field by the way is of >> long type. >> >> Additionally we have certain boolean and constant type fields named >> visibleToEndUser (boolean) and entityType (a java enum between 0 to 5). >> >> The first field defaultSearch is a copyField which contains a copy of all >> the values of 6 text type fields that I have mentioned. >> >> The way we query presently using the default search handler is like this. >> >> defaultSearch:(Dog) AND (group_id:2181347 OR group_id:2181364 OR >> group_id:2216624 OR group_id:2216990) AND (entityType:0) AND >> (visibleToEndUser:true) >> >> We want to start using the dismax (if not dismax then edismax) query >> handler but so far I have not been able to replicate the query mentioned >> above to the equivalent dismax form. >> >> What I cannot figure out is? >> >> 1. How do I apply exact match on the group_id, visibleToEndUser and the >> entityType fields? Or How how do I query a specific field with a specific >> value rather than searching across all fields with all values. >> 2. How do I apply OR and AND conditions? >> >> >> Swapnonil Mukherjee >> >> >> >> >>
Maximum of length of a Dismax Query?
Hi Everybody, It seems that the maximum query length supported by the Dismax Query Handler is 3534 characters. Is there anyway I can set this limit to be around 12,000? If I fire a query beyond 3534 characters, I don't even get error messages in the catalina.XXX log files. Swapnonil Mukherjee +91-40092712 +91-9007131999
Re: Maximum of length of a Dismax Query?
I am using the SOLRJ client to post my query, The query length is roughly 10,000 characters. I am using GET like this. int page = 1; int resultsPerPage = 24; ModifiableSolrParams params = new ModifiableSolrParams(); params.set("q", query); params.set("start", "" + (page - 1) * resultsPerPage); params.set("rows", resultsPerPage); try { QueryResponse response = QueryServerManager.getSolrServer().query(params, SolrRequest.METHOD.GET); assertNotNull(response); } catch (SolrServerException e) { e.printStackTrace(); } This hits the exception block with the following exception org.apache.solr.client.solrj.SolrServerException: java.net.SocketException: Connection reset at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:472) at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:243) at org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:89) at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:122) at com.getty.search.tests.DismaxQueryTestCase.testAssetQuery(DismaxQueryTestCase.java:34) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.textui.TestRunner.doRun(TestRunner.java:116) at com.intellij.junit3.JUnit3IdeaTestRunner.doRun(JUnit3IdeaTestRunner.java:108) at junit.textui.TestRunner.doRun(TestRunner.java:109) at com.intellij.junit3.JUnit3IdeaTestRunner.startRunnerWithArgs(JUnit3IdeaTestRunner.java:42) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:192) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:64) Swapnonil Mukherjee On 29-Oct-2010, at 12:44 PM, Swapnonil Mukherjee wrote: > Hi Everybody, > > It seems that the maximum query length supported by the Dismax Query Handler > is 3534 characters. Is there anyway I can set this limit to be around 12,000? > > If I fire a query beyond 3534 characters, I don't even get error messages in > the catalina.XXX log files. > > Swapnonil Mukherjee > +91-40092712 > +91-9007131999 > > >
Re: Maximum of length of a Dismax Query?
Solved this issue, by setting the maxHttpHeaderSize to 65536 in tomcat/conf/server.xml file. Otherwise Tomcat was not responding. Swapnonil Mukherjee On 29-Oct-2010, at 2:43 PM, Swapnonil Mukherjee wrote: I am using the SOLRJ client to post my query, The query length is roughly 10,000 characters. I am using GET like this. int page = 1; int resultsPerPage = 24; ModifiableSolrParams params = new ModifiableSolrParams(); params.set("q", query); params.set("start", "" + (page - 1) * resultsPerPage); params.set("rows", resultsPerPage); try { QueryResponse response = QueryServerManager.getSolrServer().query(params, SolrRequest.METHOD.GET); assertNotNull(response); } catch (SolrServerException e) { e.printStackTrace(); } This hits the exception block with the following exception org.apache.solr.client.solrj.SolrServerException: java.net.SocketException: Connection reset at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:472) at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:243) at org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:89) at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:122) at com.getty.search.tests.DismaxQueryTestCase.testAssetQuery(DismaxQueryTestCase.java:34) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.textui.TestRunner.doRun(TestRunner.java:116) at com.intellij.junit3.JUnit3IdeaTestRunner.doRun(JUnit3IdeaTestRunner.java:108) at junit.textui.TestRunner.doRun(TestRunner.java:109) at com.intellij.junit3.JUnit3IdeaTestRunner.startRunnerWithArgs(JUnit3IdeaTestRunner.java:42) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:192) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:64) Swapnonil Mukherjee On 29-Oct-2010, at 12:44 PM, Swapnonil Mukherjee wrote: Hi Everybody, It seems that the maximum query length supported by the Dismax Query Handler is 3534 characters. Is there anyway I can set this limit to be around 12,000? If I fire a query beyond 3534 characters, I don't even get error messages in the catalina.XXX log files. Swapnonil Mukherjee +91-40092712 +91-9007131999
Does edismax support wildcard queries?
Hi Everybody, We have started to the use the dismax query handler but one serious limitation of it is that it does not support wild card queries? I think I have 2 ways to overcome this problem 1. Apply some old patches to the dismax parser itself from here https://issues.apache.org/jira/browse/SOLR-756 2. Or start using the Solr trunk which will allow me to switch to edismax. I am specially hopeful of moving to solr trunk and using edismax as I believe this well help me support fuzzy search in future as well. So my question is does edismax support wildcard queries? I could not understand by looking at the source code though. Thanks Swapnonil Mukherjee
Re: Does edismax support wildcard queries?
Thanks. I downloaded and built the solr trunk to test for wild card queries and as you guys reported, edismax does support wildcards and it works beautifully. My next challenge will be to apply these patches 1. https://issues.apache.org/jira/browse/SOLR-1553 2. https://issues.apache.org/jira/browse/SOLR-2058 to the apache-solr-1.4.1 as using the trunk is something which we cannot do. On 18-Nov-2010, at 7:28 PM, Thumuluri, Sai wrote: > It does support wildcard queries - we are using that feature from > edismax > > -Original Message----- > From: Swapnonil Mukherjee [mailto:swapnonil.mukher...@gettyimages.com] > Sent: Thursday, November 18, 2010 1:39 AM > To: solr-user@lucene.apache.org > Subject: Does edismax support wildcard queries? > > Hi Everybody, > > We have started to the use the dismax query handler but one serious > limitation of it is that it does not support wild card queries? I think > I have 2 ways to overcome this problem > > 1. Apply some old patches to the dismax parser itself from here > https://issues.apache.org/jira/browse/SOLR-756 > 2. Or start using the Solr trunk which will allow me to switch to > edismax. I am specially hopeful of moving to solr trunk and using > edismax as I believe this well help me support fuzzy search in future as > well. > > So my question is does edismax support wildcard queries? I could not > understand by looking at the source code though. > > Thanks > Swapnonil Mukherjee > > >
Is there a way to view the values of "stored=false" fields in search results?
Hi All, I have setup certain fields to be indexed=true and stored=false. According to the documentation fields marked as stored=false do not appear in search results, which is perfectly ok. But now I have a situation where I need to debug to see the value of these fields. So is there a way to see the value of stored=false fields? With Regards Swapnonil Mukherjee
Unknown query type 'edismax'
Hi, I just downloaded apache-solr-1.4.1 and am trying to run an edismax query using the defType argument as edismax. But I am setting an Unkown query type exception. Mar 23, 2011 10:28:42 AM org.apache.solr.common.SolrException log SEVERE: org.apache.solr.common.SolrException: Unknown query type 'edismax' at org.apache.solr.core.SolrCore.getQueryPlugin(SolrCore.java:1462) at org.apache.solr.search.QParser.getParser(QParser.java:251) at org.apache.solr.handler.component.QueryComponent.prepare(QueryComponent.java:88) at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:174) at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:131) at org.apache.solr.core.SolrCore.execute(SolrCore.java:1316) at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:338) at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:241) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1089) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:365) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405) at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:211) at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139) at org.mortbay.jetty.Server.handle(Server.java:285) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:502) at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:821) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:513) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:208) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:378) at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:226) at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442) Do I need to make any changes to solrconfig.xml to get edismax queries to work? Swapnonil Mukherjee +91-40092712 +91-9007131999
Re: Unknown query type 'edismax'
Hi, I have downloaded apache-solr1.4.1 and then applied patch SOLR-1553 to enable the EdismaxParserQueryPlugin, but inspite of this I get the Unknown query type error. Swapnonil Mukherjee +91-40092712 +91-9007131999 On 23-Mar-2011, at 4:36 PM, Ahmet Arslan wrote: >> I just downloaded apache-solr-1.4.1 and am trying to run an >> edismax query using the defType argument as edismax. >> > > You need 3.1 or trunk for that. > > "NOTE: Solr 3.1 will include an experimental version of the Extended DisMax > parsing" http://wiki.apache.org/solr/DisMaxQParserPlugin > > >
Re: Unknown query type 'edismax'
Hi, It worked! Thanks a lot. At least I don't get the stacktrace on the jetty console and the Unknown query type error after adding this entry to the solrconfig.xml. We will have to examine the results to see if the Edismax parser is really kicking in. Swapnonil Mukherjee +91-40092712 +91-9007131999 On 23-Mar-2011, at 7:14 PM, Ahmet Arslan wrote: >> I have downloaded apache-solr1.4.1 and then applied patch >> SOLR-1553 to enable the EdismaxParserQueryPlugin, but >> inspite of this I get the Unknown query type error. > > Hmm, I don't know about whether it is usable/compatible with solr 1.4.1 but > you can try to register edismax in solrconfig.xml as follows:, > > class="org.apache.solr.search.ExtendedDismaxQParserPlugin"/> > > > >