Here is a more readable version: http://gist.github.com/247213
Any help would be appreciated On Dec 2, 1:08 am, Grobie <[email protected]> wrote: > Hi, > > I've encountered a problem with integer fields and associated > attributes. I can't search by the integer field for records with more > than 3 digits as integer value. Here is a reduced example. > > script/generate model User code:integer > script/generate model Address user:references > > class User < ActiveRecord::Base > has_many :addresses > > define_index do > indexes :code > has addresses(:id), :as => :addresses_ids > end > end > > I create 3 records with [333, 999, 1000] as values for code. There are > no associated addresses. After indexing the records and starting the > searchd I open a console: > > script/console > >> User.all > User Load (0.4ms) SELECT * FROM `users` > => [#<User id: 1, code: 333, created_at: "2009-12-01 23:47:29", > updated_at: "2009-12-01 23:47:29">, > #<User id: 2, code: 999, created_at: "2009-12-01 23:47:34", > updated_at: "2009-12-01 23:47:34">, > #<User id: 3, code: 1000, created_at: "2009-12-01 23:47:36", > updated_at: "2009-12-01 23:47:36">] > >> User.search 333 > Querying Sphinx: 333 > User Load (0.3ms) SELECT * FROM `users` WHERE (`users`.`id` IN > (1)) > => [#<User id: 1, code: 333, created_at: "2009-12-01 23:47:29", > updated_at: "2009-12-01 23:47:29">] > >> User.search 999 > Querying Sphinx: 999 > User Load (0.3ms) SELECT * FROM `users` WHERE (`users`.`id` IN > (2)) > => [#<User id: 2, code: 999, created_at: "2009-12-01 23:47:34", > updated_at: "2009-12-01 23:47:34">] > >> User.search 1000 > Querying Sphinx: 1000 > => [] > > And here is my problem. I get no results for "1000". I can do a search > for "100*" and get the one record. But this is not an option for my > production application. If there is no "has addresses(:id)" attribute, > I can do search for 1000 and all is fine. > > I don't use any specific sphinx config. I use thinking-sphinx > (1.2.12), Sphinx 0.9.8.1-release (r1533) and Rails 2.3.4. I've already > found a discussion for this problem, but there is no solution as far I > can see. (http://groups.google.com/group/thinking-sphinx/browse_thread/ > thread/7c62eeb4944faef7/b2c1a13ea8bd95fb? > lnk=gst&q=123#b2c1a13ea8bd95fb). > > Can you reproduce the problem? Do you have any suggestions? > thanks -- 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.
