ThinkingSphinx exits, enters ActsAsSolrReloaded

I used to work with ThinkingSphinx until the day I needed to index documents with dynamic attributes. As Sphinx indexes data from the result of an SQL query, the goal didn’t seem possible.

I decided then to take another look at Solr. Solr, differently from Sphinx, is an HTTP server and indexes data from posted XML documents. Each document can have a different structure, so it fits perfectly with the model of dynamic attributes.

Thiago Jackwin, aka RailsFreaks, created a plugin that integrates Rails with Solr called acts_as_solr. The plugin is very good, but Thiago disappeared from the map some time ago, he lost the domain, left GitHub and doesn’t answer emails any more. As a result of this, different forks and forks of forks have been created and the Git tree became a mess.

Annoyed with the situation of the project, I decided to fork the fork I liked the most and created a new repository called acts_as_solr_reloaded, with new features. This way, I hope the project gets easier to be found and that it gives more trust. I’m also compromising myself to keep the repository up to date and to pull contributions.

As today, the new features acts_as_solr_reloaded comes with are:

  • support for dynamic attributes
  • geo-localization or geo-spatial search
  • integration with acts-as-taggable-on
  • highlighting
  • relevance ranking

To support geo-localization in Solr, it needed to be updated to the version 1.4 .

To make easier the experience of working with dynamic attributes and geo-localization, a few generators that setup the database were added to the project. You can use them like this:

script/generate dynamic_attributes_migration
script/generate local_migration

You can after define your model this way:

class Document < ActiveRecord::Base
  acts_as_solr :dynamic_attributes => true,
               :spatial => true,
               :taggable => true
end

Note that with :taggable => true you dont need to define your model as acts_as_taggable_on :tags, it’s done automatically.

To better demonstrate the new features in acts_as_solr_reloaded, I recorded a small video of five minutes showing the functionalities in action, hope you like it:

New features in ActsAsSolrReloaded from Diego Carrion on Vimeo.

Note that in the video I used acts_as_taggable_on :tags and :taggable => true, at the time of the recording this both declarations were necessary, not anymore.

If you appreciate this work, please consider to recommend me at Working With Rails.

38 thoughts on “ThinkingSphinx exits, enters ActsAsSolrReloaded

    • Posted on November 8, 2012 by I loved as much as you’ll receive careird out right here. The sketch is tasteful, your authored material stylish. nonetheless, you command get got an impatience over that you wish be delivering the following. unwell unquestionably come more formerly again since exactly the same nearly a lot often inside case you shield this hike.

  1. Hi Nadeem, I discovered it after I implemented the mentioned features in acts_as_solr_reloaded. I don’t know if it supports the same functionalities that acts_as_solr_reloaded has, but seems a cool option to be analyzed.

    • I once had tandoori cihkcen at a wedding and it was of very sketchy quality. My dad told me that I shouldn’t have eaten it because it was bad. That’s typical of my dad a day late and a dollar short. Anyway, bad cihkcen would be the most random thing I’ve eaten. Tacos sound way better!Your hair is gorgeous. No rat’s nest in sight. You’ll have to take a look at me right now to see that!!

  2. Hi Jeremy, I didn’t know about the xmlpipe until now. I found this:

    http://www.sphinxsearch.com/docs/current.html#xmlpipe2

    When I had the problem, I tried to find something working with ThinkingSphinx but didn’t find anything. I just tried to discover if ThinkingSphinx supports xmlpipe2 but didn’t find any reference from the official repository, just this commit from a fork:

    http://github.com/ebeigarts/thinking-sphinx/commit/8ccd28995ba23b1ee506f226e9a6002f3d86bbee

    The principal reason I change Sphinx for Solr was the dynamic attributes, but another features I like are the live updating and that I can use it with any database, as they don’t communicate.

  3. I know music is personal taste, but the music in your video actively prevented me from watching the video..
    Besides, good work!

    • Be careful tkiang medical advice from Yahoo Answers.Some of the answers to your last question were bizarre, especially the one about masturbation causing torsion of the testis.One testis larger than the other may be a result of mumps, but you should seek proper medical advice about this in your case.Sperm count tests involve examining a fresh semen sample. They are not expensive as tests go, but obviously require some privacy to produce. Talk to your doctor about this.

  4. You mention that it should be able to work with “any rails model”, but then it seems like it requires ActiveRecord. So it won’t really work with any rails model… only models derived from ActiveRecord. I’m trying to use with MongoDB and don’t use AR. I’ve already got sphinx working with Mongo thru xmlpipe, which works well. But I’d love to try out yours in comparison if it can work without requiring AR.

  5. Hi Matt, I meant to say that it works with ActiveRecord on any database, sorry for don’t being explicit.

    Btw, are you using any plugin for Sphinx? Also, which adapter are you using for MongoDB?

    Thanks for your feedback, it was very good and I will try to adapt acts_as_solr_reloaded to work with Mongo.

    • i think behr paint (behr.com) has something like that, but i beielve there is a $5 fee i’ve not used it, but i have looked at colors on the website before. also you can pick up the paint booklets/chips at home depot (from behr) and the booklets has complimentary colors and shows the paint in different rooms.i personally like the behr paint (semi gloss) because its wonderful for being able to clean it especially with kids and crayons, markers, finger paints, etc. it is a little costlier than most paints, but it covers great and last great also if you use the behr paint and there is something wrong with the paint itself a behr representative will come out and paint your walls for you (there has to be something

  6. Hi Diego. I am playing with acts_as_solr_reloaded and I am having trouble getting back facet counts. Not sure if this this is a solr config issue or what. I am using jetty-solr with its out-of-the box configuration.

    I have a model that has this:
    acts_as_solr :fields => [:body], :facets => [:source_type, :project_id]

    I do a find like this:
    find_by_solr(‘tester’, {
    :highlight => {:fields => ‘body’},
    :facets=>{:zeros=>true,:fields=>[:source_type, :project_id]}
    })

    and not facet counts come back (though I know there is matching data:
    facet_fields”=>{“source_type_facet”=>{}, “project_id_facet”=>{}}

    Even hitting solr directly yeilds no facet counts:

    http://localhost:8982/solr/select/?q=tester&version=2.2&start=0&rows=10&indent=on&facet=true&facet.field=project_id_facet

    Thoughts?

    • Posted on November 8, 2012 by The new Zune cute blue mittens free bsowrer is surprisingly good, but not as good as the iPod’s. It works well, but isn’t as fast as Safari, and has a clunkier interface. If you occasionally plan on using the web bsowrer that’s not an issue, but if you’re planning to browse the web alot from your PMP then the iPod’s larger screen and better bsowrer may be important.

    • OK did the OK did the exercises easy to perofrm and seemed like it freed up some muscles that were trapped. Still have some pain but definitely effective. Will keep doing. Thanks.

  7. Also – searching for ‘*:*’ fails. I would typically use this if I wanted to do a faceted search without any text query.

    The error showing up in solr shows that _t is being appended:

    May 4, 2010 12:11:36 PM org.apache.solr.common.SolrException log
    SEVERE: org.apache.solr.common.SolrException: org.apache.lucene.queryParser.ParseException: Cannot parse ‘(*_t:*) AND (t
    ype_s:Post)’: ‘*’ or ‘?’ not allowed as first character in WildcardQuery

    • Posted on November 8, 2012 by I was basically wanitng to know if you ever considered adjusting the page layout of your web site? It is well written; I love what you have got to state. But maybe you can create a little more in the way of written content so people can connect to it better. Youve got an awful lot of text for only having one or two photographs. Maybe you could space it out better?

    • I used to be suggested this blog by means of my cuoisn.I’m not positive whether or not this post is written through him as no one else realize such distinct about my problem. You are amazing! Thank you!

    • . HOWEVER, Woman B claimed she had never said athiynng to A about my wife spreading the rumors and that she was simply concerned about her. She was sorry, apologized, but understood if my wife didn’t trust her as a friend. My wife was hurt, but choose to forgive woman B and move on and attempt to repair things with woman A.The next morning, woman B went to A and told her what my wife had done to her. Woman A was concerned about the accuracy of the information she was getting from B. Woman A asked her again if she was sure that what she had said at the party was true, including the party about my wife telling many different people and maliciously attempting to start the rumors. B said this was all true again, and that my wife was really upset with A and wanted to bring her down with what she said.A week later, my wife tried to talk to woman A to apologize for what was said. Woman A would not even look at my wife. She said she was done with her as a friend. She explained that woman B had come back to her to tell her she had been talking about her AGAIN, and she reiterated about the fact she had been spreading the rumors maliciously and my wife wanted to hurt woman A. None of this was true. Woman A called my wife a slew of fowl language in front of me, in front of dozens of her close friends and in front of many of my wife’s friends. She stated that she was lying because woman B had said these things to her twice, and that she wouldn’t lie.My wife is woman A’s boss. Woman A is letting this effect her work. Woman A has cut off all communication with my wife outside of work. Woman B is now completely avoiding my wife entirely as well as woman B’s husband, who is a close friend of mine.My wife forgave them both for what happened. Several weeks has passed. I have a hard time forgiving these people and wanted them to ever be back at our home. They were both very good friends of my wife’s and now she feels alone and isolated because her two best friends destroyed their friendship. I even lost a close friend. The collateral damage goes very deep, since these were mutual friends of almost everyone we know.My wife wants me to move on, but I have such a hard time with that. My wife was trying to do the biblically accurate thing to hold a fellow sister in christ accountable and her other sister in christ; who was not a new christian, but a strong one, threw it in her face. She broke her trust not once, but twice.I just think she doesn’t need to be friends with these people if this is how they treat their relationships. I don’t feel comfortable having them around my home if this is what they choose to do.What do you think?

    • Posted on November 8, 2012 by I have realized that in diiatgl camera models, exceptional sensors help to concentrate automatically. These sensors regarding some cams change in in the area of contrast, while others employ a beam associated with infra-red (IR) light, specifically in low light. Higher specification cameras from time to time use a blend of both models and may have Face Priority AF where the dslr camera can See’ a face and focus only in that. Many thanks for sharing your thinking on this blog site.

  8. hi, i’m currently using acts_as_solr_reloaded but i’m having trouble indexing rich documents, receiving tika exceptions. i wonder if its able to support?

  9. Hi, Diego

    how do to work in rails 3?

    i saw that acts_as_taggable_on work different in rails 3, the acts_as_solr_reloaded change too?

  10. I would like to thank you for the efforts you have put in writing this web site. I’m hoping the same high-grade website post from you in the upcoming as well. In fact your creative writing skills has encouraged me to get my own website now. Actually the blogging is spreading its wings rapidly. Your write up is a good example of it.

    • that we should frgoive and forget’. Even if this were actually possible, we are certainly not required to even attempt anything like it if they are unrepentent and likely to offend again on the same serious way. We are entitled to say within ourselves something like: whilst I have handed calling you to account over to God, and whilst I pray that you will see the light, understand what you have done and repent, and apologise so that we can safely be reconciled, I now know you and what you are like, and I choose to guard my heart and the hearts of those under my protection, and (for the time being anyway) to love you in absence.By doing this, as well as protecting ourselves (we are not called to continually cast our pearls in front of swine’) and giving ourselves time and space for our own healing, we give those who have done us wrong the chance to experience that we no longer seek their company, but at the same do not carry any resentment towards them. If it is God’s will that we should be reconciled to them and resume an active friendship, then this course of action can have a powerfully positive challenging effect. If it does not, then it is better that we let them go and enable God to give us something/someone else instead.We hope you find this reply of help.God bless and guide you.

    • It’s a very wise answer of Mr/s Snout.The first fetlirity test commonly performed in order to diagnose the cause of male infertility is the semen analysis test. Any problems affecting sperm shape (morphology), sperm movement (motility), or sperm count will require a semen analysis test. The cost of infertility tests can range from a few hundred to a few thousand dollars, depending on the sophistication of the required fetlirity test.Good luck.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">