Finally got it. Version difference between local and remote version of solr 
meant different defaults on some fields. Field type Long get DocValues even if 
you leave it unchecked and also changed to multivalue=false. This results in 
"cannot change DocValues type from SORTED_SET to NUMERIC for field". Beats me 
what it expects for values in document.addField(...), but changing the field 
type from Long to Int fixed it.

-----Original Message-----
From: Phil Scadden [mailto:p.scad...@gns.cri.nz]
Sent: Sunday, 24 September 2017 4:35 p.m.
To: solr-user@lucene.apache.org
Subject: Solr update failing on remote server but works locally??

I am attempted to redo an index job. The delete query worked fine but on 
reindex, I get this:
09:42:51,061 ERROR ConcurrentUpdateSolrClient:463 - error
org.apache.solr.common.SolrException: Bad Request



request: http://online-uat:8983/solr/prindex/update?wt=javabin&version=2
                at 
org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrClient$Runner.sendUpdateStream(ConcurrentUpdateSolrClient.java:290)
                at 
org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrClient$Runner.run(ConcurrentUpdateSolrClient.java:161)
                at 
org.apache.solr.common.util.ExecutorUtil$MDCAwareThreadPoolExecutor$1.run(ExecutorUtil.java:231)
                at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
                at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
                at java.lang.Thread.run(Thread.java:745)

The same code works fine when the solr instance is local on my test machine. 
The remote machine is reachable. The prindex core seems fine. A delete query to 
remove old index executed fine. But update fails. I am not sure to begin 
looking. "Sendupdatestream" would indicate solr.up is trying to send the string 
but some the request format is wrong????
http://online-uat:8983/solr/prindex/select?q=*:*
just returns:
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">0</int>
<lst name="params">
<str name="q">*:*</str>
</lst>
</lst>
<result name="response" numFound="0" start="0"/> </response>

Which is consistant with deleting everything but having the syntax correct?

The updating code is:
       ConcurrentUpdateSolrClient solr = new 
ConcurrentUpdateSolrClient(solrProperties.getServer(),10,2);

                                ....

            File f = new File(filename);
             ContentHandler textHandler = new 
BodyContentHandler(Integer.MAX_VALUE);
             Metadata metadata = new Metadata();
             Parser parser = new AutoDetectParser();
             ParseContext context = new ParseContext();
             if (filename.toLowerCase().contains("pdf")) {
               PDFParserConfig pdfConfig = new PDFParserConfig();
               pdfConfig.setOcrStrategy(PDFParserConfig.OCR_STRATEGY.NO_OCR);
               context.set(PDFParserConfig.class,pdfConfig);
               context.set(Parser.class,parser);
             }
             InputStream input = new FileInputStream(f);
             try {
               parser.parse(input, textHandler, metadata, context);
             } catch (Exception e) {
               e.printStackTrace();
               return false;
              }
             SolrInputDocument up = new SolrInputDocument();
             if (title==null) title = metadata.get("title");
             if (author==null) author = metadata.get("author");
             up.addField("id",f.getCanonicalPath());
             up.addField("location",idString);
             up.addField("access",access);
             up.addField("datasource",datasource);
             up.addField("title",title);
             up.addField("author",author);
             String content = textHandler.toString();
             up.addField("_text_",content);
             solr.add(up);
Notice: This email and any attachments are confidential and may not be used, 
published or redistributed without the prior written consent of the Institute 
of Geological and Nuclear Sciences Limited (GNS Science). If received in error 
please destroy and immediately notify GNS Science. Do not copy or disclose the 
contents.
Notice: This email and any attachments are confidential and may not be used, 
published or redistributed without the prior written consent of the Institute 
of Geological and Nuclear Sciences Limited (GNS Science). If received in error 
please destroy and immediately notify GNS Science. Do not copy or disclose the 
contents.

Reply via email to