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.

46 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.

    • (Paperback) Admittedly, there are a ton of books which have been published about the Law of Attraction. Even thgouh it’s a popular subject right now, personally, I have had a hard time finding one, specific book that has helped me firmly grasp the concept. I came across this book by David Hooper and was, at first, drawn in by the vibrant cover. I was skeptical of whether an 80-page book was merely an introduction to the Law of Attraction or could actually be a good learning resource. I read the through the book the evening I bought it. I have to say, it turned out to be a really valuable book. The first part is devoted to explaining the LofA. There’s nothing new here and all the usual suspects from the self-help/new age movement are quoted. It’s the following chapters in which Hooper gives straightforward instruction and explanation on how to use the LoA in the areas of career, relationships and health that totally make this book worthwhile. After I read through it, I began making lists of things I wanted to draw into my life using Hooper’s suggestions on how to change my mindset to get what I wanted. Some of my smaller goals (such as finding a new hair stylist whom I could really connect with) manifested within days. It’s these experiences that give me faith that if I can make the small things happen, I can make big things happen as well. I think it is the combination of the basic easy-to-digest language and the techniques he suggest that really helped me get it . Update: A couple of days ago, I was searching Itunes for self-help audio. I was surprised to find an audio version of this book available for download. I bought it and find it a really good companion to the book.

  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!!

    • I’ve heard of Robert Collier before, moltsy in other self development books I’ve read over the years. He seems to be referred to as one of the most influential self-help authors of all time. After reading this book, I’d have to agree with that statement. The riches of health, happiness, joy, wealth, friendship, family, and success are all within our reach. Collier has a special gift with his ability to express this simple truth in a way that leaves the reader impacted for the better. I couldn’t suggest a better book for someone wishing to improve their life and the lives of those they touch.

  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.

    • joffan,I think the 50 year factor was meant to relfect that if you built the various technology installations, they would operate for 50 years while the “CMO” just lasts one year. However, it does seem to confuse the issue. A wind turbine, PV cell, or dam (if it would last 50 years) would require no additional fuel, whereas the nuclear plant needs a small amount of fuel each year and the coal plant needs huge amounts of fuel. In fact this raises a whole different question: How many cubic miles of coal does it take to equal a cubic mile of oil? Initially, this looks like a simplification but the more I look at it, the less value it seems to have.

  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

    • I saw the same error as keng, although I’d put the nbemur of 1.65MW turbines at about 130,000. The other curiosity is that the coal plants have no capacity factor (ie. 100%) but the nukes do (90%). What’s the reality on this one?Also the basic logic of the comparison is odd… how can you replace one year’s worth of oil with energy spread over 50 years?These points aside though, I’m glad someone is trying to make a simple comparison between energy sources.

  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?

    • (Paperback) This is a short book, easy to follow and very sghiatrt forward. It is a must read for anyone that is not happy with how their life is working, or even for someone who is, and wants to enrich their life further. For those skeptics out there, this stuff really works. It’s not magic, it is nature!! I encourage you to spend the short time it takes to read this book!!! But, be prepared to change!!! If you utilize the information you read, your life WILL change. I have been somewhat practicing these concepts in my life for almost a year now, without really realizing it. I have found the love of my life, have more money in my savings account than I ever imagined, have an new job that I love, and make 10% more than the job I was downsized from. I will be moving into a new home soon, and will have a new vehicle soon. This has all happened in 10 months!!!!!!!!!!!!!!!!!!!! Just read it and find out for yourself!! You will not regret it!!!!!!

    • 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.

    • WOW I’m so surprised! You fillnay jumped into the blogging insanity! I loved your first post, great writing and look forward to more words of wisdom from you. I think this calls for a celebration! Oh but now you’ll never get any sleep with painting and blogging! Hey .who needs sleep?Just nap while you’re driving!!! Congratulations and Good luck!

  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.

    • Hi folks, it’s a small thing, but i thought i would share.I was at Costco in the mddile of the day, with time to spare. How rare!I noticed that the two folks behind me were each holding a single item. Well, no problem. I asked each of them if they would like to go ahead of me, and what do you know they did!Since the checkout crew at Costco are a well-oiled team, it only took an extra 3 minutes out of my day, and made those customers pretty happy.Pay It Forward!

    • 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.

    • I think the 50 years aspect of this cpcoent is slightly confusing, however I think it is trying to capture the idea that the time to develop the project is limited. According to the CMO article on wiki, we have ~43 proven Cubic miles of oil. If you started working on the replacement you’d have ~50 years to complete it assuming that some of its capacity would come online before 50 years was up. For example, if you wanted to only solve the problem with solar cells you’d have to install 1.8million household rooftop solar installations per year for 50 years to end up with enough power to replace 1 CMO per year at the end of 50 years. It seems likely to me that you could more easily try and complete parts of each solution. Make some dams, and some solar cells, and some wind, etc. It seems like wind power has the closest cost to oil according to the wiki article.

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