Return-Path: Delivered-To: apmail-lucene-ruby-dev-archive@www.apache.org Received: (qmail 62071 invoked from network); 6 Oct 2008 20:00:01 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Oct 2008 20:00:01 -0000 Received: (qmail 48182 invoked by uid 500); 6 Oct 2008 20:00:00 -0000 Delivered-To: apmail-lucene-ruby-dev-archive@lucene.apache.org Received: (qmail 48166 invoked by uid 500); 6 Oct 2008 19:59:59 -0000 Mailing-List: contact ruby-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ruby-dev@lucene.apache.org Delivered-To: mailing list ruby-dev@lucene.apache.org Received: (qmail 48153 invoked by uid 99); 6 Oct 2008 19:59:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Oct 2008 12:59:59 -0700 X-ASF-Spam-Status: No, hits=0.1 required=10.0 tests=DNS_FROM_SECURITYSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [69.55.225.129] (HELO ehatchersolutions.com) (69.55.225.129) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Oct 2008 19:58:56 +0000 Received: by ehatchersolutions.com (Postfix, from userid 504) id 0862730EFC16; Mon, 6 Oct 2008 13:59:26 -0600 (MDT) X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on javelina X-Spam-Level: Received: from [10.0.1.198] (va-69-68-189-221.dyn.embarqhsd.net [69.68.189.221]) by ehatchersolutions.com (Postfix) with ESMTP id CE8B630EFC16 for ; Mon, 6 Oct 2008 13:59:25 -0600 (MDT) Message-Id: From: Erik Hatcher To: ruby-dev@lucene.apache.org In-Reply-To: Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v928.1) Subject: Re: jruby and solrj Date: Mon, 6 Oct 2008 15:59:24 -0400 References: X-Mailer: Apple Mail (2.928.1) X-Virus-Checked: Checked by ClamAV on apache.org X-Old-Spam-Status: No, score=1.0 required=5.0 tests=BAYES_00, DNS_FROM_SECURITYSAGE,RCVD_IN_SORBS_DUL autolearn=no version=3.1.1 Unfortunately, to call varargs from JRuby (so I just learned from irc's #jruby), you have to do this: query.add_facet_field(['cat'].to_java :string) anyway, for our solr-jruby purposes, i think we can stick to using the ModifiableSolrParams API instead of SolrQuery, but we still get varargs issues. thankfully Ruby solves this relatively nicely... solr = EmbeddedSolrServer.new(container, "core1") query = ModifiableSolrParams.new def query.abcd(key, values) add(key,(values.is_a?(Array) ? values : [values]).to_java(:string)) end query.abcd('q','*:*') query.abcd('facet.field',['cat']) response = solr.query(query) We'll just need to sprinkle a little Ruby fairy dust on some of this clunky stuff. It's not all that bad. But the varargs one is strange to me, but I'm sure there is some deep technical reason why that support isn't intuitive. Erik On Oct 6, 2008, at 1:36 AM, Ryan McKinley wrote: > just guessing, but try passing that as a string[] rather then just a > string > > The java function takes ( string ... v ) -- in java that means you > can pass either a string or an array, or a variable length list of > strings. I'm guessing that does something funny with jruby > > ryan > > > On Oct 5, 2008, at 10:54 PM, Matt Mitchell wrote: > >> I've been messing around with jRuby and SolrJ with nice results. >> But can't >> seem to get the SolrQuery.addFacetField method to work. I get this >> error: >> >> "for method addFacetField expected [[Ljava.lang.String;]; got: >> [java.lang.String]; error: argument type mismatch (TypeError)" >> >> I'm using it like: >> >> query.add_facet_field 'cat' >> >> and also tried: >> >> query.addFacetField 'cat' >> >> Any ideas as to what I'm doing wrong? >> >> Matt >> >> p.s. The other methods I've tried work great: set_query, >> set_query_type, >> set_facet, set_facet_limit, set_facet_min_count, set_include_score, >> add_sort_field.