You can only join on indexed fields, our Location:merchantId field is not indexed.
Best Erick On Tue, Jul 16, 2013 at 2:48 PM, Utkarsh Sengar <utkarsh2...@gmail.com> wrote: > Found this post: > http://mail-archives.apache.org/mod_mbox/lucene-solr-user/201302.mbox/%3CCAB_8Yd82aqq=oY6dBRmVjG7gvBBewmkZGF9V=fpne4xgkbu...@mail.gmail.com%3E > > And based on the answer, I modified my query: localhost:8983/solr/location/ > select?fq={!join from=key to=merchantId fromIndex=merchant}*:* > > I don't see any errors, but my original problem still persists, no > documents are returned. > The two fields on which I am trying to join is: > > Merchant: <field name="merchantId" type="string" indexed="true" > stored="true" multiValued="false" /> > Location: <field name="merchantId" type="string" indexed="false" > stored="true" multiValued="false" /> > > Thanks, > -Utkarsh > > > On Tue, Jul 16, 2013 at 11:39 AM, Utkarsh Sengar <utkarsh2...@gmail.com>wrote: > >> Looks like the JoinQParserPlugin is throwing an NPE. >> Query: localhost:8983/solr/location/select?q=*:*&fq={!join from=key >> to=merchantId fromIndex=merchant} >> >> 84343345 [qtp2012387303-16] ERROR org.apache.solr.core.SolrCore – >> java.lang.NullPointerException >> at >> org.apache.solr.search.JoinQuery.hashCode(JoinQParserPlugin.java:580) >> at org.apache.solr.search.QueryResultKey.<init>(QueryResultKey.java:50) >> at >> org.apache.solr.search.SolrIndexSearcher.getDocListC(SolrIndexSearcher.java:1274) >> at >> org.apache.solr.search.SolrIndexSearcher.search(SolrIndexSearcher.java:457) >> at >> org.apache.solr.handler.component.QueryComponent.process(QueryComponent.java:410) >> at >> org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:208) >> at >> org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135) >> at org.apache.solr.core.SolrCore.execute(SolrCore.java:1816) >> at >> org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:656) >> at >> org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:359) >> at >> org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:155) >> at >> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1307) >> at >> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:453) >> at >> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137) >> at >> org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:560) >> at >> org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231) >> at >> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1072) >> at >> org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:382) >> at >> org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193) >> at >> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1006) >> at >> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135) >> at >> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255) >> at >> org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154) >> at >> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) >> at org.eclipse.jetty.server.Server.handle(Server.java:365) >> at >> org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:485) >> at >> org.eclipse.jetty.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:53) >> at >> org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:937) >> at >> org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:998) >> at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:856) >> at >> org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240) >> at >> org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:72) >> at >> org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:264) >> at >> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608) >> at >> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543) >> at java.lang.Thread.run(Thread.java:662) >> >> 84343350 [qtp2012387303-16] INFO org.apache.solr.core.SolrCore – >> [location] webapp=/solr path=/select >> params={distrib=false&wt=javabin&version=2&rows=10&df=allText&fl=key,score&shard.url=x:8983/solr/location/&NOW=1373999694930&start=0&q=*:*&_=1373999505886&isShard=true&fq={!join+from%3Dkey+to%3DmerchantId+fromIndex%3Dmerchant}&fsv=true} >> status=500 QTime=6 >> 84343351 [qtp2012387303-16] ERROR >> org.apache.solr.servlet.SolrDispatchFilter – >> null:java.lang.NullPointerException >> at >> org.apache.solr.search.JoinQuery.hashCode(JoinQParserPlugin.java:580) >> at org.apache.solr.search.QueryResultKey.<init>(QueryResultKey.java:50) >> at >> org.apache.solr.search.SolrIndexSearcher.getDocListC(SolrIndexSearcher.java:1274) >> at >> org.apache.solr.search.SolrIndexSearcher.search(SolrIndexSearcher.java:457) >> at >> org.apache.solr.handler.component.QueryComponent.process(QueryComponent.java:410) >> at >> org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:208) >> at >> org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135) >> at org.apache.solr.core.SolrCore.execute(SolrCore.java:1816) >> at >> org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:656) >> at >> org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:359) >> at >> org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:155) >> at >> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1307) >> at >> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:453) >> at >> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137) >> at >> org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:560) >> at >> org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231) >> at >> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1072) >> at >> org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:382) >> at >> org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193) >> at >> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1006) >> at >> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135) >> at >> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255) >> at >> org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154) >> at >> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) >> at org.eclipse.jetty.server.Server.handle(Server.java:365) >> at >> org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:485) >> at >> org.eclipse.jetty.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:53) >> at >> org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:937) >> at >> org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:998) >> at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:856) >> at >> org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240) >> at >> org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:72) >> at >> org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:264) >> at >> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608) >> at >> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543) >> at java.lang.Thread.run(Thread.java:662) >> >> 84343363 [qtp2012387303-17] ERROR org.apache.solr.core.SolrCore – >> org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException: >> Server at http://x:8983/solr/location returned non ok status:500, >> message:Server Error >> at >> org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:372) >> at >> org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:180) >> at >> org.apache.solr.handler.component.HttpShardHandler$1.call(HttpShardHandler.java:156) >> at >> org.apache.solr.handler.component.HttpShardHandler$1.call(HttpShardHandler.java:119) >> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) >> at java.util.concurrent.FutureTask.run(FutureTask.java:138) >> at >> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439) >> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) >> at java.util.concurrent.FutureTask.run(FutureTask.java:138) >> at >> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) >> at >> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) >> at java.lang.Thread.run(Thread.java:662) >> >> 84343364 [qtp2012387303-17] INFO org.apache.solr.core.SolrCore – >> [location] webapp=/solr path=/select >> params={indent=true&q=*:*&_=1373999505886&wt=xml&fq={!join+from%3Dkey+to%3DmerchantId+fromIndex%3Dmerchant}} >> status=500 QTime=185 >> 84343365 [qtp2012387303-17] ERROR >> org.apache.solr.servlet.SolrDispatchFilter – >> null:org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException: >> Server at http://x:8983/solr/location returned non ok status:500, >> message:Server Error >> at >> org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:372) >> at >> org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:180) >> at >> org.apache.solr.handler.component.HttpShardHandler$1.call(HttpShardHandler.java:156) >> at >> org.apache.solr.handler.component.HttpShardHandler$1.call(HttpShardHandler.java:119) >> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) >> at java.util.concurrent.FutureTask.run(FutureTask.java:138) >> at >> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439) >> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) >> at java.util.concurrent.FutureTask.run(FutureTask.java:138) >> at >> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) >> at >> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) >> at java.lang.Thread.run(Thread.java:662) >> >> >> Thanks, >> -Utkarsh >> >> >> >> On Tue, Jul 16, 2013 at 5:24 AM, Erick Erickson >> <erickerick...@gmail.com>wrote: >> >>> Not quite sure what's the problem with the second, but the >>> first is: >>> q=: >>> >>> That just isn't legal, try q=*:* >>> >>> As for the second, are there any other errors in the solr log? >>> Sometimes what's returned in the response packet does not >>> include the true source of the problem. >>> >>> Best >>> Erick >>> >>> On Mon, Jul 15, 2013 at 7:40 PM, Utkarsh Sengar <utkarsh2...@gmail.com> >>> wrote: >>> > I have also tried these queries (as per this SO answer: >>> > >>> http://stackoverflow.com/questions/12665797/is-solr-4-0-capable-of-using-join-for-multiple-core >>> > ) >>> > >>> > 1. http://_server_.com:8983/solr/location/select?q=:&fq={!join >>> > from=merchantId to=merchantId fromIndex=merchant}walgreens >>> > >>> > And I get this: >>> > >>> > { >>> > "responseHeader":{ >>> > "status":400, >>> > "QTime":1, >>> > "params":{ >>> > "indent":"true", >>> > "q":":", >>> > "wt":"json", >>> > "fq":"{!join from=merchantId to=merchantId >>> > fromIndex=merchant}walgreens"}}, >>> > "error":{ >>> > "msg":"org.apache.solr.search.SyntaxError: Cannot parse ':': >>> > Encountered \" \":\" \": \"\" at line 1, column 0.\nWas expecting one >>> > of:\n <NOT> ...\n \"+\" ...\n \"-\" ...\n <BAREOPER> ...\n >>> > \"(\" ...\n \"*\" ...\n <QUOTED> ...\n <TERM> ...\n >>> > <PREFIXTERM> ...\n <WILDTERM> ...\n <REGEXPTERM> ...\n \"[\" >>> > ...\n \"{\" ...\n <LPARAMS> ...\n <NUMBER> ...\n <TERM> >>> > ...\n \"*\" ...\n ", >>> > "code":400}} >>> > >>> > And this: >>> > 2.http://_server_.com:8983/solr/location/select?q=walgreens&fq={!join >>> > from=merchantId to=merchantId fromIndex=merchant} >>> > >>> > { >>> > "responseHeader":{ >>> > "status":500, >>> > "QTime":5, >>> > "params":{ >>> > "indent":"true", >>> > "q":"walgreens", >>> > "wt":"json", >>> > "fq":"{!join from=merchantId to=merchantId fromIndex=merchant}"}}, >>> > "error":{ >>> > "msg":"Server at http://_SERVER_:8983/solr/location returned non >>> > ok status:500, message:Server Error", >>> > >>> "trace":"org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException: >>> > Server at http://_SERVER_:8983/solr/location returned non ok >>> > status:500, message:Server Error\n\tat >>> > >>> org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:372)\n\tat >>> > >>> org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:180)\n\tat >>> > >>> org.apache.solr.handler.component.HttpShardHandler$1.call(HttpShardHandler.java:156)\n\tat >>> > >>> org.apache.solr.handler.component.HttpShardHandler$1.call(HttpShardHandler.java:119)\n\tat >>> > java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)\n\tat >>> > java.util.concurrent.FutureTask.run(FutureTask.java:138)\n\tat >>> > >>> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)\n\tat >>> > java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)\n\tat >>> > java.util.concurrent.FutureTask.run(FutureTask.java:138)\n\tat >>> > >>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)\n\tat >>> > >>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)\n\tat >>> > java.lang.Thread.run(Thread.java:662)\n", >>> > "code":500}} >>> > >>> > Thanks, >>> > -Utkarsh >>> > >>> > >>> > >>> > On Mon, Jul 15, 2013 at 4:27 PM, Utkarsh Sengar <utkarsh2...@gmail.com >>> >wrote: >>> > >>> >> Hello, >>> >> >>> >> I am trying to join data between two cores: merchant and location >>> >> >>> >> This is my query: >>> >> http://_server_.com:8983/solr/location/select?q={!join from=merchantId >>> >> to=merchantId fromIndex=merchant}walgreens >>> >> Ref: http://wiki.apache.org/solr/Join >>> >> >>> >> >>> >> Merchants core has documents for the query: "walgreens" with an >>> merchantId >>> >> 1 >>> >> A simple query: http:// >>> _server_.com:8983/solr/location/select?q=walgreens >>> >> returns documents called walgreens with merchantId=1 >>> >> >>> >> Location core has documents with merchantId=1 too. >>> >> >>> >> But my join query returns no documents. >>> >> >>> >> This is the response I get: >>> >> { >>> >> "responseHeader":{ >>> >> "status":0, >>> >> "QTime":5, >>> >> "params":{ >>> >> "debugQuery":"true", >>> >> "indent":"true", >>> >> "q":"{!join from=merchantId to=merchantId >>> >> fromIndex=merchant}walgreens", >>> >> "wt":"json"}}, >>> >> "response":{"numFound":0,"start":0,"maxScore":0.0,"docs":[] >>> >> }, >>> >> "debug":{ >>> >> "rawquerystring":"{!join from=merchantId to=merchantId >>> >> fromIndex=merchant}walgreens", >>> >> "querystring":"{!join from=merchantId to=merchantId >>> >> fromIndex=merchant}walgreens", >>> >> "parsedquery":"JoinQuery({!join from=merchantId to=merchantId >>> >> fromIndex=merchant}allText:walgreens)", >>> >> "parsedquery_toString":"{!join from=merchantId to=merchantId >>> >> fromIndex=merchant}allText:walgreens", >>> >> "QParser":"", >>> >> "explain":{}}} >>> >> >>> >> >>> >> Any suggestions? >>> >> >>> >> >>> >> -- >>> >> Thanks, >>> >> -Utkarsh >>> >> >>> > >>> > >>> > >>> > -- >>> > Thanks, >>> > -Utkarsh >>> >> >> >> >> -- >> Thanks, >> -Utkarsh >> > > > > -- > Thanks, > -Utkarsh