From dev-return-18507-archive-asf-public=cust-asf.ponee.io@manifoldcf.apache.org Fri Sep 21 14:46:05 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 378F5180656 for ; Fri, 21 Sep 2018 14:46:05 +0200 (CEST) Received: (qmail 89878 invoked by uid 500); 21 Sep 2018 12:46:03 -0000 Mailing-List: contact dev-help@manifoldcf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@manifoldcf.apache.org Delivered-To: mailing list dev@manifoldcf.apache.org Received: (qmail 89612 invoked by uid 99); 21 Sep 2018 12:46:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Sep 2018 12:46:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 53D55C05CC for ; Fri, 21 Sep 2018 12:46:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.501 X-Spam-Level: X-Spam-Status: No, score=-109.501 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id IjPS8stoZbyR for ; Fri, 21 Sep 2018 12:46:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id F2E645F51F for ; Fri, 21 Sep 2018 12:46:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 1E4B3E070F for ; Fri, 21 Sep 2018 12:46:01 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 661FD23FA7 for ; Fri, 21 Sep 2018 12:46:00 +0000 (UTC) Date: Fri, 21 Sep 2018 12:46:00 +0000 (UTC) From: "Karl Wright (JIRA)" To: dev@manifoldcf.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CONNECTORS-1533) Solr Connector is unable to ingest documents MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CONNECTORS-1533?page=3Dcom.atla= ssian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId= =3D16623544#comment-16623544 ]=20 Karl Wright commented on CONNECTORS-1533: ----------------------------------------- For your reference, here is the Lucene master version of the HttpSolrClient= method we needed to update in ModifiedHttpSolrClient to make compatible wi= th SolrJ 7.4: {code} protected HttpRequestBase createMethod(SolrRequest request, String collec= tion) throws IOException, SolrServerException { if (request instanceof V2RequestSupport) { request =3D ((V2RequestSupport) request).getV2Request(); } SolrParams params =3D request.getParams(); RequestWriter.ContentWriter contentWriter =3D requestWriter.getContentW= riter(request); Collection streams =3D contentWriter =3D=3D null ? reque= stWriter.getContentStreams(request) : null; String path =3D requestWriter.getPath(request); if (path =3D=3D null || !path.startsWith("/")) { path =3D DEFAULT_PATH; } =20 ResponseParser parser =3D request.getResponseParser(); if (parser =3D=3D null) { parser =3D this.parser; } =20 // The parser 'wt=3D' and 'version=3D' params are used instead of the o= riginal // params ModifiableSolrParams wparams =3D new ModifiableSolrParams(params); if (parser !=3D null) { wparams.set(CommonParams.WT, parser.getWriterType()); wparams.set(CommonParams.VERSION, parser.getVersion()); } if (invariantParams !=3D null) { wparams.add(invariantParams); } String basePath =3D baseUrl; if (collection !=3D null) basePath +=3D "/" + collection; if (request instanceof V2Request) { if (System.getProperty("solr.v2RealPath") =3D=3D null) { basePath =3D baseUrl.replace("/solr", "/api"); } else { basePath =3D baseUrl + "/____v2"; } } if (SolrRequest.METHOD.GET =3D=3D request.getMethod()) { if (streams !=3D null || contentWriter !=3D null) { throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "GET c= an't send streams!"); } return new HttpGet(basePath + path + wparams.toQueryString()); } if (SolrRequest.METHOD.DELETE =3D=3D request.getMethod()) { return new HttpDelete(basePath + path + wparams.toQueryString()); } if (SolrRequest.METHOD.POST =3D=3D request.getMethod() || SolrRequest.M= ETHOD.PUT =3D=3D request.getMethod()) { String url =3D basePath + path; boolean hasNullStreamName =3D false; if (streams !=3D null) { for (ContentStream cs : streams) { if (cs.getName() =3D=3D null) { hasNullStreamName =3D true; break; } } } boolean isMultipart =3D ((this.useMultiPartPost && SolrRequest.METHOD= .POST =3D=3D request.getMethod()) || (streams !=3D null && streams.size() > 1)) && !hasNullStreamNa= me; LinkedList postOrPutParams =3D new LinkedList<>(); if(contentWriter !=3D null) { String fullQueryUrl =3D url + wparams.toQueryString(); HttpEntityEnclosingRequestBase postOrPut =3D SolrRequest.METHOD.POS= T =3D=3D request.getMethod() ? new HttpPost(fullQueryUrl) : new HttpPut(fullQueryUrl); postOrPut.addHeader("Content-Type", contentWriter.getContentType()); postOrPut.setEntity(new BasicHttpEntity(){ @Override public boolean isStreaming() { return true; } @Override public void writeTo(OutputStream outstream) throws IOException { contentWriter.write(outstream); } }); return postOrPut; } else if (streams =3D=3D null || isMultipart) { // send server list and request list as query string params ModifiableSolrParams queryParams =3D calculateQueryParams(this.quer= yParams, wparams); queryParams.add(calculateQueryParams(request.getQueryParams(), wpar= ams)); String fullQueryUrl =3D url + queryParams.toQueryString(); HttpEntityEnclosingRequestBase postOrPut =3D fillContentStream(requ= est, streams, wparams, isMultipart, postOrPutParams, fullQueryUrl); return postOrPut; } // It is has one stream, it is the post body, put the params in the U= RL else { String fullQueryUrl =3D url + wparams.toQueryString(); HttpEntityEnclosingRequestBase postOrPut =3D SolrRequest.METHOD.POS= T =3D=3D request.getMethod() ? new HttpPost(fullQueryUrl) : new HttpPut(fullQueryUrl); fillSingleContentStream(streams, postOrPut); return postOrPut; } } throw new SolrServerException("Unsupported method: " + request.getMetho= d()); } {code} Please compare and contrast with what is committed to the ManifoldCF code b= ase. > Solr Connector is unable to ingest documents > -------------------------------------------- > > Key: CONNECTORS-1533 > URL: https://issues.apache.org/jira/browse/CONNECTORS-153= 3 > Project: ManifoldCF > Issue Type: Bug > Components: Lucene/SOLR connector > Affects Versions: ManifoldCF 2.11 > Reporter: Julien Massiera > Assignee: Karl Wright > Priority: Major > > The "r69acbd9 - Fix solr connector content deletion bug" has introduced a= nother bug :=20 > It is now impossible to ingest documents into Solr 7.4.0, we obtain the f= ollowing error : Error from server at http://localhost:8983/solr/FileShare:= missing content stream > The fact is, the=C2=A0requestWriter.getContentWriter(request) object is e= qual to null only on commit requests. So the new lines of code introduced b= y the fix, which are based on the test of this object, result in a null=C2= =A0Collection streams object and so the update request is fa= iling. > Concerned class :=C2=A0org.apache.manifoldcf.agents.output.solr.ModifiedH= ttpSolrClient -- This message was sent by Atlassian JIRA (v7.6.3#76005)