Search by record id with ultrasphinx

152 Views Asked by At

I'm trying to search by record id with ultrasphinx on Rails 2.3.8

In my model i tried the following:

class Offer < ActiveRecord::Base
   is_indexed :fields => [{:field => 'id', :as => 'offer_id'}]
end

and

class Offer < ActiveRecord::Base
   is_indexed :fields => ['id']
end

And I search with

Ultrasphinx::Search.new(:query => "1691")

It doesn't return any results, while searching for other indexed fields does.

1

There are 1 best solutions below

2
On

Wow. a blast from the past.

Whilst I shifted to ThinkingSphinx after starting off with UltraSphinx, are you sure that you shouldn't be using


class Offer > ActiveRecord::Base
   is_indexed :fields => ['id']
end

maybe try that for now and then figure out how to do the AS after.