Take a look at ferret as a starting point.  If you need more "oomph" you can
move to either sphinx or solr.  The "Advanced Rails Recipes" book has
examples of all 3.

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Matt Harrison
Sent: Tuesday, December 08, 2009 2:53 PM
To: [email protected]
Subject: Re: [Rails] mangling search terms

On Tue, Dec 08, 2009 at 03:02:39PM +0000, Matt Harrison wrote:
> I've been working on a pet project and have just started implementing
> full-text searching with acts_as_xapian. It's working pretty well but I'm
> having trouble getting some of the bells and whistles to work.
> 
> First is the spelling correction. If it feels that there are incorrectly
> spelt words, it provides an array of the correct spellings, but without
> reference to which words it is correcting.
> 
> So if I enter the search term "the cat adn the dog", it will give an array
> ["and"] which is useless in a gsub because it can't tell what it should be
> replacing. I want to be able to say "did you mean 'the cat *and* the
dog'?"
> but I can't work out how to manipulate the string.
> 
> The second puzzle is regarding highlighting the search terms. When you
> follow a link to one of the results, it appends the search term to the
query
> and uses TextHelper::highlighter to mark those words. The problem is that
it
> is expecting an array, not a string. So I split the string by spaces, but
> what about parts of the query that were enclosed in quotes?
> 
> I have found it impossible to mangle a complex query such as:
> 
> "null pointer" undefined "static char array"
> 
> So it can be passed a query parameter and then decoded again for the
> highlighter. I've tried all sorts of regexp, splits and joins but it's
just
> given me a headache.
> 
> I know people have done this before so I'm hoping someone can give me some
> pointers. Let me know if I can provide any more information to explain
> myself better.
> 
> Many thanks
> 
> Matt

Ok I think I spoke too soon. Even after rebuilding and updating the indicies
several times, fulltext searching doesn't manage to search the entire body
of text, only the first few lines. Investigation shows that the Xapain
google groups list is almost pure spam and isn't active at all. 

I guess I've chosen a duff technology to use, so I'll need to switch. Can
anyone suggest the current favorite for fulltext searching?

I don't really care about the spelling correction or highlighting of search
terms (it interferes with my caching), just a simple search.

Thanks

Matt

--

You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.



--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.


Reply via email to