Return-Path: Delivered-To: apmail-lucene-solr-user-archive@minotaur.apache.org Received: (qmail 30112 invoked from network); 4 May 2010 20:57:14 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 4 May 2010 20:57:14 -0000 Received: (qmail 57988 invoked by uid 500); 4 May 2010 20:57:12 -0000 Delivered-To: apmail-lucene-solr-user-archive@lucene.apache.org Received: (qmail 57936 invoked by uid 500); 4 May 2010 20:57:12 -0000 Mailing-List: contact solr-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: solr-user@lucene.apache.org Delivered-To: mailing list solr-user@lucene.apache.org Received: (qmail 57928 invoked by uid 99); 4 May 2010 20:57:12 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 May 2010 20:57:12 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of f.wesemann@fotofinder.net designates 212.87.63.22 as permitted sender) Received: from [212.87.63.22] (HELO gemini.fotofinder.net) (212.87.63.22) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 May 2010 20:57:03 +0000 Received: from umbriel.fotofinder.net ([213.191.35.212]) by gemini.fotofinder.net with esmtp (Exim 4.63) (envelope-from ) id 1O9PAZ-0001En-40 for solr-user@lucene.apache.org; Tue, 04 May 2010 22:56:43 +0200 Received: from [213.191.35.210] (helo=dhcp84.cff) by umbriel.fotofinder.net with esmtp (Exim 4.69) (envelope-from ) id 1O9PAY-0005wW-GM for solr-user@lucene.apache.org; Tue, 04 May 2010 22:56:43 +0200 Message-ID: <4BE08A0A.2030408@fotofinder.net> Date: Tue, 04 May 2010 22:56:42 +0200 From: Frank Wesemann User-Agent: Thunderbird 2.0.0.9 (X11/20071115) MIME-Version: 1.0 To: solr-user@lucene.apache.org Subject: inconsistency in SolrParams.get() Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam_score: -3.0 X-Spam_score_int: -29 X-Spam_bar: --- X-Virus-Checked: Checked by ClamAV on apache.org Dear list, I recently stumpled upon this: modifiableParams = new ModifiableSolrParams( req.getParams() ); assert modifiableParams.get("key").equals( req.getParams().get("key") ); this test fails for requests built from a SimpleRequestParser or StandardRequestParser where the parameter "key" was given, but empty ( e.g. localhost:8393/select/?key=¶1=val1&parm2=val2 ). The reason is that oas.request.ServletSolrParams returns null for values with length() == 0, but all other SolrParams implementations return the empty String. This behaviour has also side effects on search components: Most, if not all, standard search components check for something like if (reg.getParams().getBool(myTriggerParameter, false) ) { ...do what I am supposed to do... } In case of ServletSolrParams getBool() returns the desired and expected "false", all other Implementations throw a "bad request" Exception. One may argue that suppling a parameter with an empty value indeed is a malformed request, but as an example, in our frontend servers we use a Perllib which always adds the "q" parameter to a SolrRequest ( and our Solr implementation allows requests without a explicit query ). Nonetheless I think, the above mentioned equality check should hold true for any request and any SolrParams. Because I cannot oversee the implications, I currently don't have a better suggestion to achieve this, than to make ServleSolrParams also return the empty String, which is in my opinion counter-intuitive and does not the right thing for the getBool(), getInt() etc. cases. Any thoughts? btw: is ModifiableSolrParams.set(key, null) removes key from the params really the desired and expected behaviour? -- mit freundlichem Gruß, Frank Wesemann Fotofinder GmbH USt-IdNr. DE812854514 Software Entwicklung Web: http://www.fotofinder.com/ Potsdamer Str. 96 Tel: +49 30 25 79 28 90 10785 Berlin Fax: +49 30 25 79 28 999 Sitz: Berlin Amtsgericht Berlin Charlottenburg (HRB 73099) Geschäftsführer: Ali Paczensky