Hi Andrea, Thanks for your help, something which is relevant and I forgot to mention before is that the requests are always a POST method. As mentioned before, it is not a single query which fails but all of the requests done to the search handler.
final SolrQuery q = new SolrQuery("!( _id_:"+ doc.getId()+")AND(_root_:"+ doc.getId()+")"); final QueryResponse query = solrClient.query(q, SolrRequest.METHOD.POST); Regarding the embedded server instantiation: . . . final CoreContainer container = CoreContainer.createAndLoad(tmpSolrHome, tmpSolrConfig); return new SolrClientWrapper(container, CORE_NAME, tmpSolrHome); . . . private class SolrClientWrapper extends EmbeddedSolrServer { private final Path temporaryFolder; public SolrClientWrapper(CoreContainer coreContainer, String coreName, Path temporaryFolder) { super(coreContainer, coreName); this.temporaryFolder = temporaryFolder; } . . . The whole embedded server instantiation can be seen here <https://github.com/RBMHTechnology/vind/blob/master/server/embedded-solr-server/src/main/java/com/rbmhtechnology/vind/solr/backend/EmbeddedSolrServerProvider.java> . Best, Alfonso. On Wed, 29 Aug 2018 at 12:57, Andrea Gazzarini <a.gazzar...@sease.io> wrote: > Hi Alfonso, > could you please paste an extract of the client code? Specifically those > few lines where you create the SolrQuery with params. > > The line you mentioned is dealing with ContentStream which as far as I > remember wraps the request body, and not the request params. So as > request body Solr expects a valid JSON payload, but in your case, if I > got you, you're sending plain query parameters (through SolrJ). > > Best, > Andrea > > On 29/08/2018 12:45, Alfonso Noriega wrote: > > Hi, > > I am implementing a migration of Vind > > <https://github.com/RBMHTechnology/vind> library from solr 5 to 7.4.0 > and I > > am facing an error which I have no idea how to solve... > > > > The library provides a wrapper (and some extra stuff) to develop search > > tools over Solr and uses SolrJ to access it, more info about it can be > seen > > in the public repo, but basically all requests are done to solr through a > > client provided by solrj. > > Actually, the migration is done and the tests running against a cloud > > instance are working perfectly fine. The issue arises when testing > against > > an embedded server (which is the default case as you may not have a local > > solr instance running), in which case every request fails throwing the > > following exception: > > *org.apache.solr.common.SolrException: Bad contentType for search handler > > :application/javabin request={q=!(+_id_:P3)AND(_root_:P3)}* > > > > * at > > > org.apache.solr.request.json.RequestUtil.processParams(RequestUtil.java:73)* > > * at > > > org.apache.solr.util.SolrPluginUtils.setDefaults(SolrPluginUtils.java:167)* > > * at > > > org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:196)* > > * at org.apache.solr.core.SolrCore.execute(SolrCore.java:2539)* > > * at > > > org.apache.solr.client.solrj.embedded.EmbeddedSolrServer.request(EmbeddedSolrServer.java:191)* > > * at > org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:194)* > > * at org.apache.solr.client.solrj.SolrClient.query(SolrClient.java:974)* > > * at org.apache.solr.client.solrj.SolrClient.query(SolrClient.java:990)* > > > > After some debugging I have seen that the embedded solr server uses > > *org.apache.solr.request.json.RequestUtil* to process the parameters > which > > invariable expects a '*application/json' *contentType but SolrJ prodcues > as > > *'application/javabin'.* > > Any ideas on how to fix this issue? > > > > The library has in the pom defined the following solr depedencies : > > *.* > > *.* > > *.* > > > > *<solr.version>7.4.0</solr.version>* > > *.* > > *.* > > *.* > > *<dependency>* > > * <groupId>org.apache.solr</groupId>* > > * <artifactId>solr-core</artifactId>* > > * <version>${solr.version}</version>* > > *</dependency>* > > *<dependency>* > > * <groupId>org.apache.solr</groupId>* > > * <artifactId>solr-solrj</artifactId>* > > * <version>${solr.version}</version>* > > *</dependency>* > > > > Thanks! > > -- -- Alfonso Noriega Software engineer Redlink GmbH e: alfonso.nori...@redlink.co <sergio.fernan...@redlink.co> w: http://redlink.co