Not sure if you've figured this out yet, but just in case...
String attributes aren't CRC'd by default. If you want location name to be
CRC'd, then your attribute definition would look like this:
join location # unless you're referring to this association elsewhere
has "CRC32(locations.name)", :as => :location, :type => :integer
And then your search should work.
It's also worth noting that this line:
has address_1, address_2, location.name, :as => :location
... creates three attributes, all named location (and so Sphinx is getting
confused). If you only want the last to have the name of :location, then the
first two columns should be on a separate line:
has address_1, address_2
has location.name, :as => :location
Hope this clarifies things.
Cheers
--
Pat
On 12/01/2011, at 7:30 PM, luckydev wrote:
> In my model, I have index code like this
>
> define_index do
> indexes :name,services.name,categories.name,alias1,alias2,alias3
>
> set_property :enable_star => 1
> set_property :min_infix_len => 2
>
> has likes
> has name, :as => :business_name
> has address_1,address_2, location.name, :as => :location,:type
> => :string
> end
>
> while indexing, it gives me this warning.
>
> WARNING: attribute 'location' not found - IGNORING
> WARNING: attribute 'location' not found - IGNORING
>
> and when searching with the below query, I get no results
>
> Entity.search(somquery, :with => {:location => "london".to_crc32})
>
> ... address_1, address_2 are string attributes.
> location is an association and name is a string column in locations
> table.
>
> Am i indexing rite.. or is there anything wrong with my attribute
> definitions ?.. please help
>
> --
> 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.
>
--
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.