Sure, but first, can you guide me on how to instruct Gemfile to use
exactly the same version you use? If that won't work, then I'll
readily do a TeamViewer session with you if you have time.

On Nov 18, 4:11 pm, Pat Allan <[email protected]> wrote:
> I'm using TS 2 with Rails 3 and with data from associations, and I'm sure 
> plenty of others are as well, so not sure a sample app will turn up the 
> problem.
>
> Would it be possible (off-list, of course) to get access to this project so I 
> can try to reproduce the problem locally?
>
> --
> Pat
>
> On 18/11/2011, at 8:59 PM, Alex Deva wrote:
>
>
>
>
>
>
>
> > Like I said at the bottom of the previous post, it's Rails 3.0.6 and
> > the latest TS on the rails3 branch.
>
> > It has to be a gem issue, because I have code that searches fine in a
> > Rails 2 app with an older version of TS, and also because the
> > sql_query produces correct results, and also because searching using
> > bin/search finds results.
>
> > Would it be possible for you to create the simplest Rails 3 app, with
> > nothing but two associated models, add an index into one and see if
> > you get any results searching by it? I'm badly stuck here.
>
> > On Nov 18, 3:54 pm, Pat Allan <[email protected]> wrote:
> >> Hmm, still nothing obvious jumping out. Which versions of Rails and 
> >> Thinking Sphinx are you using?
>
> >> --
> >> Pat
>
> >> On 18/11/2011, at 5:41 PM, Alex Deva wrote:
>
> >>> Here's the output:
>
> >>> $ bundle exec rake ts:rebuild
> >>> (in /Users/alxx/Projects/XXXXX)
> >>> Stopped search daemon (pid 59734).
> >>> Generating Configuration to /Users/alxx/Projects/XXXXX/config/
> >>> development.sphinx.conf
> >>> Sphinx 2.0.2-beta (r3019)
> >>> Copyright (c) 2001-2011, Andrew Aksyonoff
> >>> Copyright (c) 2008-2011, Sphinx Technologies Inc (http://
> >>> sphinxsearch.com)
>
> >>> using config file '/Users/alxx/Projects/XXXXX/config/
> >>> development.sphinx.conf'...
> >>> indexing index 'content_core'...
> >>> WARNING: collect_hits: mem_limit=0 kb too low, increasing to 13568 kb
> >>> collected 6 docs, 0.0 MB
> >>> sorted 0.0 Mhits, 100.0% done
> >>> total 6 docs, 225 bytes
> >>> total 0.020 sec, 11232 bytes/sec, 299.53 docs/sec
> >>> skipping non-plain index 'content'...
> >>> total 3 reads, 0.000 sec, 0.1 kb/call avg, 0.0 msec/call avg
> >>> total 9 writes, 0.000 sec, 0.1 kb/call avg, 0.0 msec/call avg
> >>> Started successfully (pid 61215).
>
> >>> Here's the index definition (in the Content model):
>
> >>> define_index do
> >>>    indexes body
> >>>    indexes user.username, :as => :username
> >>> end
>
> >>> Here's the generated sql_query in config/development.sphinx.conf:
>
> >>> sql_query = SELECT SQL_NO_CACHE `contents`.`id` * CAST(1 AS SIGNED) +
> >>> 0 AS `id` , `contents`.`body` AS `body`, `users`.`username` AS
> >>> `username`, `contents`.`id` AS `sphinx_internal_id`, 0 AS
> >>> `sphinx_deleted`, CASE IFNULL(`contents`.`type`, '') WHEN 'Quote' THEN
> >>> 2863719664 WHEN 'Article' THEN 3448190970 ELSE 829950261 END AS
> >>> `class_crc`, IFNULL(`contents`.`type`, '') AS `sphinx_internal_class`
> >>> FROM `contents` LEFT OUTER JOIN `users` ON `users`.`id` =
> >>> `contents`.`user_id` WHERE (`contents`.`id` >= $start AND
> >>> `contents`.`id` <= $end) GROUP BY `contents`.`id`, `contents`.`type`
> >>> ORDER BY NULL
>
> >>> Running it in a console for $start = 0 and $end = 10000 does indeed
> >>> retrieve all the records, with the "username" association properly
> >>> renamed and all.
>
> >>> Other than the generated sql_query there are no differences between
> >>> the generated config when it works, and the one generated when it
> >>> doesn't (I've done a diff).
>
> >>> If I do an app-wide search...
>
> >>>> ThinkingSphinx.search 'azi'
> >>> => [#<Article id: 5, user_id: 42, ...]
>
> >>> So it definitely returns an Article (which inherits from the indexed
> >>> Content). But if I narrow the same search to the Article class...
>
> >>>> ThinkingSphinx.search 'azi', :classes => [Article]
> >>> => []
>
> >>> And, the main problem (searching on both classes just to show you:
>
> >>>> Article.search + Content.search
> >>> => []
>
> >>> This is on OSX 10.6.8 with ruby 1.9.2, Rails 3.0.6, Sphinx 2.0.2-beta
> >>> and whatever version of thinking-sphinx was installed by Gemfile from
> >>> the rails3 branch. Don't know how to check the version number but I've
> >>> run bundle update and nothing happened, so I guess it's the most
> >>> recent one today. I can't understand why, but thinking-sphinx doesn't
> >>> show up in vendor/cache (although riddle-1.5.0 is there).
>
> >>> Any ideas?
>
> >>> On Nov 18, 5:20 am, Pat Allan <[email protected]> wrote:
> >>>> Hi Alex
>
> >>>> Doesn't seem like you're doing anything odd… can you share the output 
> >>>> from when you run the index task?
>
> >>>> --
> >>>> Pat
>
> >>>> On 17/11/2011, at 11:20 PM, Alex Deva wrote:
>
> >>>>> Just a quick note to say I've noticed this happens for ANY
> >>>>> associations, not only HABTM. I've tried to add indices like:
>
> >>>>> indexes user.id, :as => :user_id
>
> >>>>> and after rebuild, no results are found. If I comment out the line and
> >>>>> rebuild, there they are again.
>
> >>>>> And strangely enough, searching using ThinkingSphinx.search works just
> >>>>> fine...
>
> >>>>> On Nov 17, 5:49 pm, Alex Deva <[email protected]> wrote:
> >>>>>> I've got a Content that habtm Areas. The index looks like this:
>
> >>>>>>   define_index do
> >>>>>>     indexes title, :sortable => true
> >>>>>>     indexes body
> >>>>>>     indexes areas(:name), :as => :area_name, :sortable => true
>
> >>>>>>     has created_at
> >>>>>>   end
>
> >>>>>> After I rebuild the index and restart Sphinx, I get no results even
> >>>>>> for a simple Content.search, just an empty array.
>
> >>>>>> If I simply comment the line that indexes areas(:name), search
> >>>>>> instantly works and finds stuff.
>
> >>>>>> What am I doing wrong?
>
> >>>>> --
> >>>>> 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 
> >>>>> athttp://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 
> >>> athttp://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 
> > athttp://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.

Reply via email to