Adding second index resulting in wrong results

0 views
Skip to first unread message

James Earl

unread,
Dec 30, 2009, 4:40:00 PM12/30/09
to Thinking Sphinx
I just added a new, second index, and I'm now getting incorrect
results... and I'm not touching/using the new index. If I remove the
new/second define_index block, the problem goes away. The second
index is bare bones. The problem appears to be related to a source
query attribute in my primary index. Enabling my new/second index,
and commenting out the source query attribute, and replacing it with a
simple category_id attribute and things work.

In terms of what results I'm getting that are wrong... basically just
products from other categories other than the one I'm currently
viewing.

# 1. Primary index
class Product
define_index do
...
has "SELECT products.id * 1 + 0 AS id, c1.id AS category_ids FROM
products LEFT JOIN categories ON products.category_id = categories.id
LEFT OUTER JOIN categories c1 ON categories.lft BETWEEN c1.lft AND
c1.rgt", :as => :category_ids, :source => :query
end
end

# 2. New secondary index
class ProductApplication
define_index do
indexes whatever
end
end

Are there any gotchas I could be overlooking?

Thanks

Pat Allan

unread,
Jan 2, 2010, 12:48:52 AM1/2/10
to thinkin...@googlegroups.com
Hi James

Is ProductApplication a subclass of Product? Just wondering why you're stating the index as a secondary one...

Either way, looking at the generated *.sphinx.conf file (minus database passwords) is a good place to start. And what kind of search queries are you trying?

--
Pat

> --
>
> You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group.
> To post to this group, send email to thinkin...@googlegroups.com.
> To unsubscribe from this group, send email to thinking-sphi...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/thinking-sphinx?hl=en.
>
>

James Earl

unread,
Jan 2, 2010, 1:04:21 PM1/2/10
to Thinking Sphinx
Thanks for the response. Looks like I just needed to change: "...
products.id * 1 + 0 ..." to "... products.id * 2 + 0 ...". When I
added the ProductApplication index, it became the first index in
*.sphinx.conf.
Reply all
Reply to author
Forward
0 new messages