简体   繁体   中英

SOLRJ giving me strange error when trying to add a pdf to a new core. "You must type correct path"

So starting to update ancient solr app to 9.1 and also the SolrJ indexer. When I try to add a document, I am getting Exception in thread "main" org.apache.solr.client.solrj.impl.BaseHttpSolrClient$RemoteSolrException: Error from server at http://my.host:8983/solr/qmap : Searching for Solr You must type the correct path Solr will respond

I can see the qmap core in the solr admin and solr is running.

Code is:

public class DocumentIndexer {
private final  String fileToIndex;
private final ConcurrentUpdateHttp2SolrClient solrClient;
private final Http2SolrClient http2Client;

public DocumentIndexer(String solrUrl, String fileToIndex) {
    this.fileToIndex =fileToIndex;
    http2Client = new Http2SolrClient.Builder().build();
    solrClient = new ConcurrentUpdateHttp2SolrClient.Builder(solrUrl, http2Client).build();
}

public void indexDocuments() throws IOException, SolrServerException{
  ContentStreamUpdateRequest req = new ContentStreamUpdateRequest("/update/extract");
  req.setAction(AbstractUpdateRequest.ACTION.COMMIT, true, true);
  req.addFile(new File(fileToIndex),"application/xml");
  req.setParam("id", fileToIndex);
  req.process(solrClient);
  solrClient.commit(true, true);
}

}

Simple enough - update/extract was not defined in the solrconfig. Recreating the core using the sample_techproducts_examples as template supplies this or alternatively setting up the solrconfig with the update/extract path defined.

Also, req.setParam("id", fileToIndex) needs to be changed to req.setParam("literal.id", fileToIndex)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM