Return-Path: Delivered-To: apmail-lucene-ruby-dev-archive@www.apache.org Received: (qmail 76919 invoked from network); 30 Sep 2008 01:41:14 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 30 Sep 2008 01:41:14 -0000 Received: (qmail 42662 invoked by uid 500); 30 Sep 2008 01:41:13 -0000 Delivered-To: apmail-lucene-ruby-dev-archive@lucene.apache.org Received: (qmail 42651 invoked by uid 500); 30 Sep 2008 01:41:13 -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 42640 invoked by uid 99); 30 Sep 2008 01:41:13 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Sep 2008 18:41:13 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of goodieboy@gmail.com designates 64.233.182.190 as permitted sender) Received: from [64.233.182.190] (HELO nf-out-0910.google.com) (64.233.182.190) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Sep 2008 01:40:09 +0000 Received: by nf-out-0910.google.com with SMTP id g16so688283nfd.15 for ; Mon, 29 Sep 2008 18:40:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type:references; bh=Vyp6T0PH55ljPqwxScVw8Yo7XpGy/GaHYAfyjAV4uow=; b=NBU3OxwxFMMI41jKj5pWrWZvrSTH5S/tjJV/0uj5lpD0qHzADvNAaXEbgV5ubplJsO yLBhpooEVn2WZZ+yriKypx4y1HbvJ5Z90HYbmvcKLsnIQwWBmOoP4XM4PcOke9ebdooY z8NmI40+j41lmfs/I2BGGjzB/lxBjv7TjZf2w= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:references; b=aRTtGkFObq3nK5prwIQH3+F4f1qNy92ixagidyMSSquf6Qt9uL+Oinqzc1nbKp1xgV z7VMwj44BJs1ZGMOKxSWH2NJgVZUhzwcEKg7QMSvpuzAPYV0jzw6ZX3DzcCUMohM5RbX QvUV1CiN4UL5WF5g50SomTvUzLwsSpvuKB8Sg= Received: by 10.102.228.10 with SMTP id a10mr4286103muh.109.1222738842085; Mon, 29 Sep 2008 18:40:42 -0700 (PDT) Received: by 10.103.1.10 with HTTP; Mon, 29 Sep 2008 18:40:42 -0700 (PDT) Message-ID: Date: Mon, 29 Sep 2008 21:40:42 -0400 From: "Matt Mitchell" To: ruby-dev@lucene.apache.org Subject: Re: Ideas for simplifying solr-ruby and making it better In-Reply-To: <48E10E60.5000206@r.email.ne.jp> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_24362_26752597.1222738842069" References: <48E003C1.2020301@r.email.ne.jp> <48E10E60.5000206@r.email.ne.jp> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_24362_26752597.1222738842069 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi Koji. Thanks for the feedback! In regard to the arbitrary query param issue. There are a few reasons why I brought that up. The first is that there have been times where I wanted to pass in something to Solr and solr-ruby hadn't yet supported it. Which means there needs to be a continuous process of field mapping integration, at least enough to keep up with the latest Solr param spec. Probably won't be be a real problem, but it did happen to me once. Another issue is that, sometimes I feel like the mapping gets in the way. Remembering all of the Solr params is one thing, but then when you use solr-ruby you have to remember a whole new set. Oh and the solr params are shorter :) c.query(:q=>'battery operated', :fq=>'location:Chicago', :qf=>'title^0.5', :fl=>'title, man, price') # v.s. c.query(:query=>'battery operated', :filter_queries=>['location:Chicago'], :query_fields=>'title^0.5', :field_list=>['title', 'man', 'price']) It'd be really nice to have the field mapping be optional, and even better... plugable field mapping! For the class placeholder issue... if we first start with the request classes, we see there is a :response_format, :content_type, and a :handler. The rest of the data is essentially query param stuff (field mapping). To make it really simple, the :handler could dissapear, it'd just be set in the method ('select' for a :query or :search, 'update' for a :delete etc.). The :response_format could be set based on the :wt value. And the :content_type could be a preset attribute in the connection instance. So, with that, you just provide a method that accepts a hash of params. The current request classes in solr-ruby (Solr::Request::Dismax etc.) really look like query field mappers to me, that's what the bulk of the code is doing it seems. So imagine for a querying... the connection class, a simple query method, and then something like the current Solr::Request::Standard being thrown in as a plugable mapper? Not to promote inheritence :) but if Solr::Connection provided raw query -> HTTP, you could do something like: MyConnection < Solr::Connection def query(params) super map(params) # the real query method accepts only raw solr params... end protected def map(params) # convert my param structure to a raw solr query string... end end But there are better ways to do this in Ruby! Matt -- as an example, here is something I threw together a few weeks ago just to get a feel for the minimal code needed for talking to solr. This is nothing more than an experiment, hasn't been tested, and of course isn't a "real" project! lib: http://github.com/mwmitchell/slite/tree/master/lib/slite.rb example: http://github.com/mwmitchell/slite/tree/master/README > > > * ability to pass in arbitrary query fields directly to solr without > > worrying about solr-ruby raising an error > > Why do you need this ability? > > Other than those above, I think you show good things up > to start our discussion and they are interesting. > I'd like to get comments/feedbacks from my associate (rubyist). > > Cheers, > > Koji > > ------=_Part_24362_26752597.1222738842069--