Need some help: Searchlogic 2.0

Searchlogic was the first gem I built. I learned A LOT along the way and I continued to learn after releasing it. As such, there are some things I would do differently now. I would say the #1 lesson I learned is don’t release a complicated gem as your first gem. For example, my first gem should have been Settingslogic. What makes Searchlogic complicated is NOT idea behind it, its the integration with ActiveRecord, and the influence ActiveRecord had on the library design. I’m not sure if you’ve ever peaked in the ActiveRecord internals, but it’s by far one of the most complicated libraries I’ve ever had to deal with. I feel like I know my way around ruby pretty well, and there are still some things in ActiveRecord that kick my ass. I’m sure ActiveRecord is in the same boat as Searchlogic, if DHH or the rails team had to start from scratch, I’m sure there are some things they would do differently. Writing an ORM library is no easy task, and ActiveRecord is an excellent solution. Probably much better than anything I could do myself.

That being said, just like any library, there are new bugs and problems people find when they use them in unique situations. This is fine and expected, the problem is that solving these problems and writing tests for them takes a lot more time than it should because it is complicated. Between my other open source projects and my job I simply do not have time to keep up with all of them. So I have 2 choices:

  1. Stop supporting the library and let someone else take it over
  2. Rewrite the library so it is easily maintainable

I am choosing #2. For 2 reasons:

  1. I have some very important projects using this library, as I’m sure you do. So I am personally invested into this library.
  2. Authlogic

Why Authlogic? Because I feel VERY good about the design behind Authlogic. Not to sound conceited, but the design behind it is really clean. It’s extremely easy to maintain and understand. As such, I don’t have to spend that much time on it. Most of the time I spend on it is adding new features that people need, not fixing bugs. Which is a lot of fun. I rarely get problems reported with Authlogic. So instead of writing tests and fixing bugs I am advancing the library. I want to have the same feeling with searchlogic, and I’m just not right now.

A call for help

That being said, I want to see if anyone wants to help out. I have some really good ideas about how to do this and keep it clean and simple. Because of this, I think it could be done in a relatively short amount of time. More importantly, it could be a fun project and a good experience for both of us.

The idea behind Searchlogic 2.0

If you are interested, here is the big change that I want to make. I initially want to write the library as a stand alone class, with no ORM integration. I just want to build a simple library the people can use to create search objects, etc. Then you could take this object and boil it down to whatever format you want, including ActiveRecord find options. So essentially you would have an ActiveRecord adapter. This is the key to keeping the library simple, it doesn’t have to rely on ActiveRecord and it’s not influenced by some of the poor design decisions behind it. For example:

search = Searchlogic.new
search.where.name_like = "sweet deal"
search.page = 2
search.per_page = 10

search.to_ar_find_options
# =>  {:conditions => ["name like ?", "%sweet deal%"], :offset => 10, :limit => 10}
search.where.to_ar_conditions
# => ["name like ?", "%sweet deal%"]

search.to_sql
# => "where name like '%sweet deal%' limit 10 offset 10"

search.to_dm_find_options
# DataMapper find options

See where I’m going with this? It’s strictly influenced by what we think is useful when searching data. It’s not influenced by SQL, ActiveRecord, or anything. It’s completely stand alone. I think this is a MUCH cleaner approach. It completely separates Searchlogic from ActiveRecord, so its a stand alone library. I don’t have to worry about “ActiveRecord changed this…”, or “ActiveRecord added this…”, etc.

I want to keep searchlogic clean and simple with no dependencies. I think this project would be a lot of fun, but the fact is that I do not have time to sit down and write a new library like this and still fulfill my responsibilities at my job. Gotsta pay them bills.

  • Share/Save/Bookmark


7 Responses to “Need some help: Searchlogic 2.0”

  1. Hector Gomez says:

    I did a very cool rails project involving the Scielo group (an open scientific library), we
    focused in cites but the search functionality was very important, but several problems limited our sucess at that time.
    I think searchlogic 2.0 would be a huge boost that will enable me some wicked stuff for this pet project of mine. So I want to put my name in the hat. :P

  2. benjohnson says:

    Hi Hector, sounds great! I’ll get in touch with you for more details.

  3. Hello Ben,
    first of all I would like to thank you for having accustomed rails developers to contributions of the highest usefulness/quality ratio.

    I would be more than willing to help you with Searchlogic 2.0 and even if I think I am not the best person to help you coding the project, I nevertheless could fund that effort with my own money.

    I believe that other members of the rails community feel the same way, so I suggest to consider funding through donations of the community.

    This path would give a concrete measure of the interest in Searchlogic while keeping the project financially viable.

    My best regards.

    • Tom Hartwell says:

      Hey Ben, I’m really getting into writing elegant ruby code (it’s making more sense everyday) and I would love to help in the great refactor. I’ve been looking for a way to be more active in the ruby community and also contribute to open source and this would be perfect.

      Thanks,
      Tom

  4. I think it’s a great idea. An “agnostic search adapter” if you will. I like your methodology and would love to use something like that for projects that I’ll be working on.

    Drop me a line and I’d love to help.

  5. benjohnson says:

    Hi Michelangelo and Rahsun, I will get in touch with you this week. Thanks for your comments!

  6. beerkg says:

    Hi, Ben
    If you’r still looking for help, I’ll be glad to join this project.