lucene-ruby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt Mitchell" <goodie...@gmail.com>
Subject Re: Ideas for simplifying solr-ruby and making it better
Date Mon, 29 Sep 2008 13:37:14 GMT
Hey Koji,

Yeah I've seen that page before. I'd love to see solr-ruby get to that
point!

I wonder if starting from the top down would be a good way to approach this
discussion. Like talking about the public API then talk about the code
underneath to support it, then refactoring etc.. So even before discussing
something request/response "placeholder" classes problem, I'll just express
some of the API things that I've always wanted and/or disliked ;)

* more rich and customizable document model:

  documents.each do {|doc| puts d.class==MyCustomDocClass}

* more rich and customizable facet model:

  response.facets.each do |facet|
    facet.field
    facet.hits
  end

* set document class type dynamically within result set before iterating:

  documents.assign_doc_class do |raw_doc|
    return Models::CD if doc[:format_type]=='CD'
    return Models::StandardDoc
  end

  # this would be nice because sometimes we're iterating through a result
set with entirely different "types" of docs.

* document field method accessors
    doc.id (or at least doc[:id])
    # instead of
    doc['id']

* pagination aware result sets (documents and facets)

    documents.total_pages # etc.
    response.facets.has_next?

* ability to pass in arbitrary query fields directly to solr without
worrying about solr-ruby raising an error

* ability to bypass query field mapping completely while querying

* flatten :facets mapping so that:

  :facets=>{:fields=>[]}
  # becomes
  :facet_fields=>[]

* ability to query a custom :query_type and NOT having to create a custom
request/response class pair

Those things are pretty easy to implement. I'd imagine that if solr-ruby has
a solid API, and a simpler code base it'd also be pretty easy to implement
some of the ORM-like features included on the wiki page and even a more DSL
like approach to regular querying:

response = connectiion.search do |q|
  q.per_page 10
  q.query 'twain'
  q.filter_query :title, 'finn'
  q.facet_fields :title, :author
  q.query_field :title, 0.5
end

What do you think?

Matt

On Sun, Sep 28, 2008 at 6:22 PM, Koji Sekiguchi <koji@r.email.ne.jp> wrote:

> Matt,
>
> > Do any of you have ideas or things that you've disliked about solr-ruby?
> If
> > so, please say so! I've got all kinds of ideas I'd like to implement and
> > crank out, but for now I want to see what other people are thinking.
>
> I don't have a concrete idea of making it better, but I agree with you.
> Do you have the idea? let's discuss it to be things more rubyish.
>
> see also:
> http://wiki.apache.org/solr/solr-ruby/BrainStorming
>
> Koji
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message