lucene-ruby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt Mitchell" <>
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

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|

* 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

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

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

* pagination aware result sets (documents and facets)

    documents.total_pages # etc.

* 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:

  # becomes

* 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 = 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

What do you think?


On Sun, Sep 28, 2008 at 6:22 PM, Koji Sekiguchi <> 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:
> Koji

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