Hi Edd
I *think* the following will work:
FeedEntry.search "(Michael Jackson) | (Alice in Chains) | (Terminator)",
:match_mode => :boolean
Only the boolean and extended modes allow for ORs/pipes, and you need
to group each set of words together.
Cheers
--
Pat
On 30/09/2009, at 9:09 PM, empika wrote:
>
> Hi
>
> Now I finally have sphinx up and running im trying perform a search on
> my model. Id like to search on two fields: "name" and "summary" and I
> would like to be able to perform boolean/extended searches so i can
> search for things like "Michael Jackson | Alice in Chains |
> Terminator" and get results back that have any of those terms in
> either the name or summary. However I cant seem to get the set up
> right.
>
> My model looks like:
>
> class FeedEntry < ActiveRecord::Base
> belongs_to :feed
> validates_uniqueness_of :guid
>
> define_index do
> indexes :name
> indexes summary
> has feed_id, :as => :feed_id
> has :published_at
> set_property :match_mode => :extended
> end
>
> end
>
> Searching for:
> FeedEntry.search("Alice in Chains")
> or
> FeedEntry.search("Dinosaur")
> both return correct results with either search term in the name or
> summary but...
>
> searching for:
> FeedEntry.search("Alice in Chains | Dinosaur")
> returns nothing.
>
> How should I set up my define_index to do this or is there somthing
> more complicated?
> Is it somthing to do with :extended not being able to search across
> multiple fields?
> Do I have to define some sort of :includes or set up a scope?
>
> Ive tried a bunch of things and have gotten as far as I think I can
> get on my own with Google and the docs on http://freelancing-god.github.com
> so figured Id ask on here, so many thanks in advance for any help.
>
> Thanks
> Edd
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Thinking Sphinx" 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/thinking-sphinx?hl=en
-~----------~----~----~----~------~----~------~--~---