Question regarding solrj
Hi Solr Gurus, I have some doubt related to solrj client. My scenario is like this: - There is a proxy server (Play App) which internally queries solr. - The proxy server is called from client side, which uses Solrj library. The issue is that I can't change client code. I can only change configurations to call different servers, hence I need to use SolrJ. - Results are successfully returned from my play app in *java-bin*format without modify them, but on client side, I am receiving this exception: Caused by: java.lang.NullPointerException * at org.apache.solr.common.util.JavaBinCodec.readExternString(JavaBinCodec.java:689)* * at org.apache.solr.common.util.JavaBinCodec.readVal(JavaBinCodec.java:188)* * at org.apache.solr.common.util.JavaBinCodec.unmarshal(JavaBinCodec.java:112)* * at org.apache.solr.client.solrj.impl.BinaryResponseParser.processResponse(BinaryResponseParser.java:41)* * at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:385)* * at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:180)* * at org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:90)* * at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:310)* * at com.ibm.commerce.foundation.internal.server.services.search.util.SearchQueryHelper.query(SearchQueryHelper.java:125)* * at com.ibm.commerce.foundation.server.services.rest.search.processor.solr.SolrRESTSearchExpressionProcessor.performSearch(SolrRESTSearchExpressionProcessor.java:506)* * at com.ibm.commerce.foundation.server.services.search.SearchServiceFacade.performSearch(SearchS* erviceFacade.java:193) I am not sure, if this exception is related to some issue in response format or with respect to querying non-solr server from solrj. Let me know your thoughts Thanks, Prashant
Re: Question regarding solrj
Thanks for your feedback. Following are some more details Version of solr : 4.3.0 Version of solrj : 4.3.0 The way I am returning response to client: Request Holder is the object containing post process request from client (After renaming few of the fields, and internal to external mapping of the fields) ** WS.WSRequestHolder requestHolder = WS.url(url); // requestHolder processing of few fields return requestHolder.get().map( new F.Function() { @Override public Result apply(WS.Response response) throws Throwable { System.out.println("Response header: " + response.getHeader("Content-Type")); System.out.println("Response: " + response.getBody()); *return ok(response.asByteArray()).as(response.getHeader("Content-Type"));* } } ); Thanks, Prashant On Sun, Apr 13, 2014 at 3:35 AM, Furkan KAMACI wrote: > Hi; > > If you had a chance to change the code at client side I would suggest to > try that: > > http://lucene.apache.org/solr/4_2_1/solr-solrj/org/apache/solr/client/solrj/impl/HttpSolrServer.html#setParser(org.apache.solr.client.solrj.ResponseParser) > There > maybe a problem about character encoding of your Play App and here is the > information: > > Javabin is a custom binary format used to write out Solr's response in a > fast and efficient manner. As of Solr 3.1, the JavaBin format has changed > to version 2. Version 2 serializes strings differently: instead of writing > the number of UTF-16 characters followed by the bytes in Modified UTF-8 it > writes the number of UTF-8 bytes followed by the bytes in UTF-8. > > Which version of Solr and Solrj do you use respectively? On the other hand > if you give us more information I can help you because there may be any > other interesting thing as like here: > https://issues.apache.org/jira/browse/SOLR-5744 > > Thanks; > Furkan KAMACI > > > 2014-04-12 22:18 GMT+03:00 Prashant Golash : > > > Hi Solr Gurus, > > > > I have some doubt related to solrj client. > > > > My scenario is like this: > > > >- There is a proxy server (Play App) which internally queries solr. > >- The proxy server is called from client side, which uses Solrj > library. > >The issue is that I can't change client code. I can only change > >configurations to call different servers, hence I need to use SolrJ. > >- Results are successfully returned from my play app in > > *java-bin*format without modify them, but on client side, I am > > receiving this > >exception: > > > > Caused by: java.lang.NullPointerException > > * at > > > > > org.apache.solr.common.util.JavaBinCodec.readExternString(JavaBinCodec.java:689)* > > * at > > org.apache.solr.common.util.JavaBinCodec.readVal(JavaBinCodec.java:188)* > > * at > > > org.apache.solr.common.util.JavaBinCodec.unmarshal(JavaBinCodec.java:112)* > > * at > > > > > org.apache.solr.client.solrj.impl.BinaryResponseParser.processResponse(BinaryResponseParser.java:41)* > > * at > > > > > org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:385)* > > * at > > > > > org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:180)* > > * at > > > > > org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:90)* > > * at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:310)* > > * at > > > > > com.ibm.commerce.foundation.internal.server.services.search.util.SearchQueryHelper.query(SearchQueryHelper.java:125)* > > * at > > > > > com.ibm.commerce.foundation.server.services.rest.search.processor.solr.SolrRESTSearchExpressionProcessor.performSearch(SolrRESTSearchExpressionProcessor.java:506)* > > * at > > > > > com.ibm.commerce.foundation.server.services.search.SearchServiceFacade.performSearch(SearchS* > > erviceFacade.java:193) > > > > I am not sure, if this exception is related to some issue in response > > format or with respect to querying non-solr server from solrj. > > > > Let me know your thoughts > > > > Thanks, > > Prashant > > >
Re: Question regarding solrj
Sorry for not replying!!! It was wrong version of solrj that client was using (As it was third-party code, we couldn't find out earlier). After fixing the version, things seem to be working fine. Thanks for your response!!! On Sun, Apr 13, 2014 at 7:26 PM, Erick Erickson wrote: > You say "I can't change the client". What is the client written in? > What does it expect? Does it use the same version of SolrJ? > > Best, > Erick > > On Sun, Apr 13, 2014 at 6:40 AM, Prashant Golash > wrote: > > Thanks for your feedback. Following are some more details > > > > Version of solr : 4.3.0 > > Version of solrj : 4.3.0 > > > > The way I am returning response to client: > > > > > > Request Holder is the object containing post process request from client > > (After renaming few of the fields, and internal to external mapping of > the > > fields) > > > > ** > > > > WS.WSRequestHolder requestHolder = WS.url(url); > > // requestHolder processing of few fields > > return requestHolder.get().map( > > new F.Function() { > > @Override > > public Result apply(WS.Response response) > > throws Throwable { > > System.out.println("Response header: > " > > + response.getHeader("Content-Type")); > > System.out.println("Response: " + > > response.getBody()); > > *return > > ok(response.asByteArray()).as(response.getHeader("Content-Type"));* > > } > > } > > ); > > > > Thanks, > > Prashant > > > > > > On Sun, Apr 13, 2014 at 3:35 AM, Furkan KAMACI >wrote: > > > >> Hi; > >> > >> If you had a chance to change the code at client side I would suggest to > >> try that: > >> > >> > http://lucene.apache.org/solr/4_2_1/solr-solrj/org/apache/solr/client/solrj/impl/HttpSolrServer.html#setParser(org.apache.solr.client.solrj.ResponseParser) > >> There > >> maybe a problem about character encoding of your Play App and here is > the > >> information: > >> > >> Javabin is a custom binary format used to write out Solr's response in a > >> fast and efficient manner. As of Solr 3.1, the JavaBin format has > changed > >> to version 2. Version 2 serializes strings differently: instead of > writing > >> the number of UTF-16 characters followed by the bytes in Modified UTF-8 > it > >> writes the number of UTF-8 bytes followed by the bytes in UTF-8. > >> > >> Which version of Solr and Solrj do you use respectively? On the other > hand > >> if you give us more information I can help you because there may be any > >> other interesting thing as like here: > >> https://issues.apache.org/jira/browse/SOLR-5744 > >> > >> Thanks; > >> Furkan KAMACI > >> > >> > >> 2014-04-12 22:18 GMT+03:00 Prashant Golash : > >> > >> > Hi Solr Gurus, > >> > > >> > I have some doubt related to solrj client. > >> > > >> > My scenario is like this: > >> > > >> >- There is a proxy server (Play App) which internally queries solr. > >> >- The proxy server is called from client side, which uses Solrj > >> library. > >> >The issue is that I can't change client code. I can only change > >> >configurations to call different servers, hence I need to use > SolrJ. > >> >- Results are successfully returned from my play app in > >> > *java-bin*format without modify them, but on client side, I am > >> > receiving this > >> >exception: > >> > > >> > Caused by: java.lang.NullPointerException > >> > * at > >> > > >> > > >> > org.apache.solr.common.util.JavaBinCodec.readExternString(JavaBinCodec.java:689)* > >> > * at > >> > > org.apache.solr.common.util.JavaBinCodec.readVal(JavaBinCodec.java:188)* > >> > * at > >> > > >> > org.apache.solr.common.util.JavaBinCodec.unmarshal(JavaBinCodec.java:112)* > >> > * at > >> > > >> > > >> > org.apache.solr.client.solrj.impl.BinaryResponseParser.processResponse(BinaryResponseParser.java:41)* > >> > * at > >
Core "creation" and "reload"
Hi, I was just wondering between the two actions "creation" and "reload" of core and have some doubts. Hope to clarify it. a) *Reload core* - Happens when we explicitly "reloads the core". If reloading fails (due to malformed config like elevate.xml etc), then solr keep on serving request from old searcher (old core). Is this right? b) *Creation of core* - This will happen when solr is restarted. Are there any other ways by which we can trigger creation of already existing core (for e.g by changing any file on solr like solrcore.properties or solr.xml?). I have scenario where we push some files from git to solr (rsync all files forcefully). While tailing logs, I found that sometimes core creation is happening, but it does not happen every-time I push configs, so I am confused why it is happening and not able to correctly figure out the end-to-end flow. Please let me know your thoughts? Thanks, Prashant
Regarding edismax parsing
Hi, I have a question regarding to parsing of tokens in edismax parser and subsequently a follow up question related to same. - Each field has list of analyzers and tokenizers as configured in schema.xml (Index and query time). Now, say I search for query - red shoes. So, is it like that for forming Disjunction query on each field, edismax will first apply analyzers configured to that field, and then form the query. For e.g if field1 has changes red to rd and field2 changes red to re, query will be like - (field1:rd) | (field2:re) ? - If above holds true, then when I changed ordering of analyzers and put "SynonymFilterFactory" at top of all analyzers (in schema.xml), edismax still tokenizes the query first with respect to space and then only apply synonym filter factory, which leads me to think that this is not happening. My use case is like , before applying any tokenizer, I want to support phrase level synonym replacement and do rest of analysis. Thanks, Prashant Golash