has Highest Rating (the plusminus tally in gem) DESC has Lowest Rating (the plusminus tally in gem) ASC has Most Ratings (total amount of votes) DESC has Lesast Ratings (total amount of votes) ASC
# Comment out the line below to allow multiple votes per user. validates_uniqueness_of :voteable_id, :scope => [:voteable_type, :voter_type, :voter_id]
I added this to my person model to filter by Most/Least amount of ratings:
has_many :votes, as: :voteable
define_index do
has "COUNT(votes.id)", as: :rating, type: :integer join votes
end
Although it isn't filtering the results by the number of votes that person has correctly.
The other issue is figuring out how to index the Highest and Lowest Rating. (AKA plusminus method in thumbs_up)
plusminus = (votes_for - votes_against)
votes_for is total votes that are equal to 1 for voteable_id and voteable_type votes_against is total votes that are equal to 0 for voteable_id and voteable_type
Anyone able to make sense of this in sql for the attributes to index =)
> has Highest Rating (the plusminus tally in gem) DESC > has Lowest Rating (the plusminus tally in gem) ASC > has Most Ratings (total amount of votes) DESC > has Least Ratings (total amount of votes) ASC
Well It appears that I got this one to work today, after browsing the TS group and looking at more COUNT queries. I needed to add "has votes(:id), :as => :vote_ids) first:
define_index do
has votes(:id), as: :vote_ids has "COUNT(DISTINCT votes.id)", as: :rating_count, type: :integer join votes
> # Comment out the line below to allow multiple votes per user. > validates_uniqueness_of :voteable_id, :scope => [:voteable_type, > :voter_type, :voter_id]
> I added this to my person model to filter by Most/Least amount of ratings:
> has_many :votes, as: :voteable
> define_index do
> has "COUNT(votes.id)", as: :rating, type: :integer > join votes
> end
> Although it isn't filtering the results by the number of votes that person > has correctly.
> The other issue is figuring out how to index the Highest and Lowest > Rating. (AKA plusminus method in thumbs_up)
> plusminus = (votes_for - votes_against)
> votes_for is total votes that are equal to 1 for voteable_id and > voteable_type > votes_against is total votes that are equal to 0 for voteable_id and > voteable_type
> Anyone able to make sense of this in sql for the attributes to index =)
> On Monday, November 5, 2012 10:56:18 PM UTC-5, Mike C. wrote:
>> has Highest Rating (the plusminus tally in gem) DESC >> has Lowest Rating (the plusminus tally in gem) ASC >> has Most Ratings (total amount of votes) DESC >> has Least Ratings (total amount of votes) ASC
The join call should be enough... shouldn't be any different to adding in the vote_ids attribute as well.
As for highest/lowest rating, this should do the trick:
has "SUM(CASE vote WHEN TRUE THEN 1.0 ELSE -1.0 END)", :as => :plusminus, :type => :float
It's important to note that Sphinx integer attributes are unsigned, so you wouldn't get totals less than zero working properly - hence using floats instead. If you're using MySQL, then you can use an IF function instead, or stick with the case change TRUE to 1.
Anything else you're still stuck on? Sorry I've been slow to respond, things have been flat out here.
> Well It appears that I got this one to work today, after browsing the TS group and looking at more COUNT queries. I needed to add "has votes(:id), :as => :vote_ids) first:
> define_index do
> has votes(:id), as: :vote_ids > has "COUNT(DISTINCT votes.id)", as: :rating_count, type: :integer > join votes
> end
> On Wednesday, November 7, 2012 2:19:09 PM UTC-5, Mike C. wrote: > Thumbs_up generates a votes model:
> # Comment out the line below to allow multiple votes per user. > validates_uniqueness_of :voteable_id, :scope => [:voteable_type, :voter_type, :voter_id]
> I added this to my person model to filter by Most/Least amount of ratings:
> has_many :votes, as: :voteable
> define_index do
> has "COUNT(votes.id)", as: :rating, type: :integer > join votes
> end
> Although it isn't filtering the results by the number of votes that person has correctly.
> The other issue is figuring out how to index the Highest and Lowest Rating. (AKA plusminus method in thumbs_up)
> plusminus = (votes_for - votes_against)
> votes_for is total votes that are equal to 1 for voteable_id and voteable_type > votes_against is total votes that are equal to 0 for voteable_id and voteable_type
> Anyone able to make sense of this in sql for the attributes to index =)
> On Monday, November 5, 2012 10:56:18 PM UTC-5, Mike C. wrote: > Anyone have experience with indexing vote ranks with the Thumbs_up gem?
> I'm trying to figure out these 4 attributes:
> has Highest Rating (the plusminus tally in gem) DESC > has Lowest Rating (the plusminus tally in gem) ASC > has Most Ratings (total amount of votes) DESC > has Least Ratings (total amount of votes) ASC
> -- > You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group. > To view this discussion on the web visit https://groups.google.com/d/msg/thinking-sphinx/-/SDTFBQML9nQJ. > To post to this group, send email to thinking-sphinx@googlegroups.com. > To unsubscribe from this group, send email to thinking-sphinx+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/thinking-sphinx?hl=en.
Thanks much for the response! You're right I removed the vote_ids attribute and also the has_many association since it seems the association is added with the acts_as_voteable call on the top of model and the votes are still working fine for Most amount of ratings and Least amount of ratings.
Although I haven't had luck yet with:
has "SUM(CASE vote WHEN TRUE THEN 1.0 ELSE -1.0 END)", :as => :plusminus, :type => :float
It seems like it should work the way you have it, although when I filter the results it doesn't show the top rated results.
I get something like this:
Person1 Person2 Person3 Person4
+5 +1 +2 +8
Instead of:
Person4 Person1 Person3 Person2
+8 +5 +2 +1
(Think I used a different email for the response and it wasn't showing up on the board so reposting it here.)
On Thursday, November 8, 2012 4:13:39 AM UTC-5, Pat Allan wrote:
> The join call should be enough... shouldn't be any different to adding in > the vote_ids attribute as well.
> As for highest/lowest rating, this should do the trick:
> has "SUM(CASE vote WHEN TRUE THEN 1.0 ELSE -1.0 END)", :as => > :plusminus, :type => :float
> It's important to note that Sphinx integer attributes are unsigned, so you > wouldn't get totals less than zero working properly - hence using floats > instead. If you're using MySQL, then you can use an IF function instead, or > stick with the case change TRUE to 1.
> Anything else you're still stuck on? Sorry I've been slow to respond, > things have been flat out here.
> -- > Pat
> On 08/11/2012, at 1:04 PM, Mike C. wrote:
> > Well It appears that I got this one to work today, after browsing the TS > group and looking at more COUNT queries. I needed to add "has votes(:id), > :as => :vote_ids) first:
> > define_index do
> > has votes(:id), as: :vote_ids > > has "COUNT(DISTINCT votes.id)", as: :rating_count, type: :integer > > join votes
> > end
> > On Wednesday, November 7, 2012 2:19:09 PM UTC-5, Mike C. wrote: > > Thumbs_up generates a votes model:
> > # Comment out the line below to allow multiple votes per user. > > validates_uniqueness_of :voteable_id, :scope => [:voteable_type, > :voter_type, :voter_id]
> > Although it isn't filtering the results by the number of votes that > person has correctly.
> > The other issue is figuring out how to index the Highest and Lowest > Rating. (AKA plusminus method in thumbs_up)
> > plusminus = (votes_for - votes_against)
> > votes_for is total votes that are equal to 1 for voteable_id and > voteable_type > > votes_against is total votes that are equal to 0 for voteable_id and > voteable_type
> > Anyone able to make sense of this in sql for the attributes to index =)
> > On Monday, November 5, 2012 10:56:18 PM UTC-5, Mike C. wrote: > > Anyone have experience with indexing vote ranks with the Thumbs_up gem?
> > I'm trying to figure out these 4 attributes:
> > has Highest Rating (the plusminus tally in gem) DESC > > has Lowest Rating (the plusminus tally in gem) ASC > > has Most Ratings (total amount of votes) DESC > > has Least Ratings (total amount of votes) ASC
> > -- > > You received this message because you are subscribed to the Google > Groups "Thinking Sphinx" group. > > To view this discussion on the web visit > https://groups.google.com/d/msg/thinking-sphinx/-/SDTFBQML9nQJ. > > To post to this group, send email to thinkin...@googlegroups.com<javascript:> > . > > To unsubscribe from this group, send email to > thinking-sphi...@googlegroups.com <javascript:>. > > For more options, visit this group at > http://groups.google.com/group/thinking-sphinx?hl=en.
Hey Pat! My apologies I didn't read you're last sentence this morning stating the difference between MYSQL and Postgresql for the query. I was using mysql and I was planning on switching over to postgres and now that I did It works perfect =) thx much!
On Thursday, November 8, 2012 9:53:52 AM UTC-5, Mike C. wrote:
> Thanks much for the response! You're right I removed the vote_ids > attribute and also the has_many association since it seems the association > is added with the acts_as_voteable call on the top of model and the votes > are still working fine for Most amount of ratings and Least amount of > ratings.
> Although I haven't had luck yet with:
> has "SUM(CASE vote WHEN TRUE THEN 1.0 ELSE -1.0 END)", :as => :plusminus, > :type => :float
> It seems like it should work the way you have it, although when I filter > the results it doesn't show the top rated results.
> I get something like this:
> Person1 Person2 Person3 Person4
> +5 +1 +2 +8
> Instead of:
> Person4 Person1 Person3 Person2
> +8 +5 +2 +1
> (Think I used a different email for the response and it wasn't showing up > on the board so reposting it here.) > On Thursday, November 8, 2012 4:13:39 AM UTC-5, Pat Allan wrote:
>> The join call should be enough... shouldn't be any different to adding in >> the vote_ids attribute as well.
>> As for highest/lowest rating, this should do the trick:
>> has "SUM(CASE vote WHEN TRUE THEN 1.0 ELSE -1.0 END)", :as => >> :plusminus, :type => :float
>> It's important to note that Sphinx integer attributes are unsigned, so >> you wouldn't get totals less than zero working properly - hence using >> floats instead. If you're using MySQL, then you can use an IF function >> instead, or stick with the case change TRUE to 1.
>> Anything else you're still stuck on? Sorry I've been slow to respond, >> things have been flat out here.
>> -- >> Pat
>> On 08/11/2012, at 1:04 PM, Mike C. wrote:
>> > Well It appears that I got this one to work today, after browsing the >> TS group and looking at more COUNT queries. I needed to add "has >> votes(:id), :as => :vote_ids) first:
>> > define_index do
>> > has votes(:id), as: :vote_ids >> > has "COUNT(DISTINCT votes.id)", as: :rating_count, type: :integer >> > join votes
>> > end
>> > On Wednesday, November 7, 2012 2:19:09 PM UTC-5, Mike C. wrote: >> > Thumbs_up generates a votes model:
>> > # Comment out the line below to allow multiple votes per user. >> > validates_uniqueness_of :voteable_id, :scope => [:voteable_type, >> :voter_type, :voter_id]
>> > Although it isn't filtering the results by the number of votes that >> person has correctly.
>> > The other issue is figuring out how to index the Highest and Lowest >> Rating. (AKA plusminus method in thumbs_up)
>> > plusminus = (votes_for - votes_against)
>> > votes_for is total votes that are equal to 1 for voteable_id and >> voteable_type >> > votes_against is total votes that are equal to 0 for voteable_id and >> voteable_type
>> > Anyone able to make sense of this in sql for the attributes to index =)
>> > On Monday, November 5, 2012 10:56:18 PM UTC-5, Mike C. wrote: >> > Anyone have experience with indexing vote ranks with the Thumbs_up gem?
>> > I'm trying to figure out these 4 attributes:
>> > has Highest Rating (the plusminus tally in gem) DESC >> > has Lowest Rating (the plusminus tally in gem) ASC >> > has Most Ratings (total amount of votes) DESC >> > has Least Ratings (total amount of votes) ASC
>> > -- >> > You received this message because you are subscribed to the Google >> Groups "Thinking Sphinx" group. >> > To view this discussion on the web visit >> https://groups.google.com/d/msg/thinking-sphinx/-/SDTFBQML9nQJ. >> > 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.
> Hey Pat! My apologies I didn't read you're last sentence this morning stating the difference between MYSQL and Postgresql for the query. I was using mysql and I was planning on switching over to postgres and now that I did It works perfect =) thx much!
> On Thursday, November 8, 2012 9:53:52 AM UTC-5, Mike C. wrote: > Thanks much for the response! You're right I removed the vote_ids attribute and also the has_many association since it seems the association is added with the acts_as_voteable call on the top of model and the votes are still working fine for Most amount of ratings and Least amount of ratings.
> Although I haven't had luck yet with:
> has "SUM(CASE vote WHEN TRUE THEN 1.0 ELSE -1.0 END)", :as => :plusminus, :type => :float
> It seems like it should work the way you have it, although when I filter the results it doesn't show the top rated results.
> I get something like this:
> Person1 Person2 Person3 Person4
> +5 +1 +2 +8
> Instead of:
> Person4 Person1 Person3 Person2
> +8 +5 +2 +1
> (Think I used a different email for the response and it wasn't showing up on the board so reposting it here.)
> On Thursday, November 8, 2012 4:13:39 AM UTC-5, Pat Allan wrote: > The join call should be enough... shouldn't be any different to adding in the vote_ids attribute as well. > As for highest/lowest rating, this should do the trick:
> has "SUM(CASE vote WHEN TRUE THEN 1.0 ELSE -1.0 END)", :as => :plusminus, :type => :float
> It's important to note that Sphinx integer attributes are unsigned, so you wouldn't get totals less than zero working properly - hence using floats instead. If you're using MySQL, then you can use an IF function instead, or stick with the case change TRUE to 1.
> Anything else you're still stuck on? Sorry I've been slow to respond, things have been flat out here.
> -- > Pat
> On 08/11/2012, at 1:04 PM, Mike C. wrote:
> > Well It appears that I got this one to work today, after browsing the TS group and looking at more COUNT queries. I needed to add "has votes(:id), :as => :vote_ids) first:
> > define_index do
> > has votes(:id), as: :vote_ids > > has "COUNT(DISTINCT votes.id)", as: :rating_count, type: :integer > > join votes
> > end
> > On Wednesday, November 7, 2012 2:19:09 PM UTC-5, Mike C. wrote: > > Thumbs_up generates a votes model:
> > # Comment out the line below to allow multiple votes per user. > > validates_uniqueness_of :voteable_id, :scope => [:voteable_type, :voter_type, :voter_id]
> > Although it isn't filtering the results by the number of votes that person has correctly.
> > The other issue is figuring out how to index the Highest and Lowest Rating. (AKA plusminus method in thumbs_up)
> > plusminus = (votes_for - votes_against)
> > votes_for is total votes that are equal to 1 for voteable_id and voteable_type > > votes_against is total votes that are equal to 0 for voteable_id and voteable_type
> > Anyone able to make sense of this in sql for the attributes to index =)
> > On Monday, November 5, 2012 10:56:18 PM UTC-5, Mike C. wrote: > > Anyone have experience with indexing vote ranks with the Thumbs_up gem?
> > I'm trying to figure out these 4 attributes:
> > has Highest Rating (the plusminus tally in gem) DESC > > has Lowest Rating (the plusminus tally in gem) ASC > > has Most Ratings (total amount of votes) DESC > > has Least Ratings (total amount of votes) ASC
> > -- > > You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group. > > To view this discussion on the web visit https://groups.google.com/d/msg/thinking-sphinx/-/SDTFBQML9nQJ. > > 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.
> -- > You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group. > To view this discussion on the web visit https://groups.google.com/d/msg/thinking-sphinx/-/oX6u-2OOl8EJ. > To post to this group, send email to thinking-sphinx@googlegroups.com. > To unsubscribe from this group, send email to thinking-sphinx+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/thinking-sphinx?hl=en.
It's strange, when I first tested the Top Rated attribute it seemed to be working, but now when testing the application with more data it doesn't seem to be doing the Tally correct. Each item can have a true vote (+1) and a false vote (-1). In the database the votes(table), votes(column) has t or f for true and false. I'm trying to sort by Top Rated items for the user model. User can be rated with a unique +1 or -1 vote. When I search with :order => "plusminus DESC" or :order => "plusminus ASC" it is not showing correct.
In my user model I have this in the Index.
define index has "COUNT(DISTINCT votes.id)", :as => :rating_count, :type => :integer #MOST RATINGS/LEAST RATINGS FILTER (WORKS) has "SUM(CASE vote WHEN TRUE THEN 1.0 ELSE -1.0 END)", :as => :plusminus, :type => :float #TOP RATED/LEAST RATED FILTER (DOESN'T WORK) join votes end
I need to get the (User's count of +1 votes) - (User's count of -1 votes)
In the results I am currently getting User out of order with +2, +1, +3, +1, +1 etc.. instead of +3, +2, +1 etc...
On Thursday, November 8, 2012 7:30:45 PM UTC-5, Pat Allan wrote:
> Great to hear :)
> -- > Pat
> On 09/11/2012, at 7:27 AM, Mike C. wrote:
> > Hey Pat! My apologies I didn't read you're last sentence this morning > stating the difference between MYSQL and Postgresql for the query. I was > using mysql and I was planning on switching over to postgres and now that I > did It works perfect =) thx much!
> > On Thursday, November 8, 2012 9:53:52 AM UTC-5, Mike C. wrote: > > Thanks much for the response! You're right I removed the vote_ids > attribute and also the has_many association since it seems the association > is added with the acts_as_voteable call on the top of model and the votes > are still working fine for Most amount of ratings and Least amount of > ratings.
> > Although I haven't had luck yet with:
> > has "SUM(CASE vote WHEN TRUE THEN 1.0 ELSE -1.0 END)", :as => > :plusminus, :type => :float
> > It seems like it should work the way you have it, although when I filter > the results it doesn't show the top rated results.
> > I get something like this:
> > Person1 Person2 Person3 Person4
> > +5 +1 +2 +8
> > Instead of:
> > Person4 Person1 Person3 Person2
> > +8 +5 +2 +1
> > (Think I used a different email for the response and it wasn't showing > up on the board so reposting it here.)
> > On Thursday, November 8, 2012 4:13:39 AM UTC-5, Pat Allan wrote: > > The join call should be enough... shouldn't be any different to adding > in the vote_ids attribute as well. > > As for highest/lowest rating, this should do the trick:
> > has "SUM(CASE vote WHEN TRUE THEN 1.0 ELSE -1.0 END)", :as => > :plusminus, :type => :float
> > It's important to note that Sphinx integer attributes are unsigned, so > you wouldn't get totals less than zero working properly - hence using > floats instead. If you're using MySQL, then you can use an IF function > instead, or stick with the case change TRUE to 1.
> > Anything else you're still stuck on? Sorry I've been slow to respond, > things have been flat out here.
> > -- > > Pat
> > On 08/11/2012, at 1:04 PM, Mike C. wrote:
> > > Well It appears that I got this one to work today, after browsing the > TS group and looking at more COUNT queries. I needed to add "has > votes(:id), :as => :vote_ids) first:
> > > Although it isn't filtering the results by the number of votes that > person has correctly.
> > > The other issue is figuring out how to index the Highest and Lowest > Rating. (AKA plusminus method in thumbs_up)
> > > plusminus = (votes_for - votes_against)
> > > votes_for is total votes that are equal to 1 for voteable_id and > voteable_type > > > votes_against is total votes that are equal to 0 for voteable_id and > voteable_type
> > > Anyone able to make sense of this in sql for the attributes to index =)
> > > On Monday, November 5, 2012 10:56:18 PM UTC-5, Mike C. wrote: > > > Anyone have experience with indexing vote ranks with the Thumbs_up gem?
> > > I'm trying to figure out these 4 attributes:
> > > has Highest Rating (the plusminus tally in gem) DESC > > > has Lowest Rating (the plusminus tally in gem) ASC > > > has Most Ratings (total amount of votes) DESC > > > has Least Ratings (total amount of votes) ASC
> > > -- > > > You received this message because you are subscribed to the Google > Groups "Thinking Sphinx" group. > > > To view this discussion on the web visit > https://groups.google.com/d/msg/thinking-sphinx/-/SDTFBQML9nQJ. > > > 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.
> > -- > > You received this message because you are subscribed to the Google > Groups "Thinking Sphinx" group. > > To view this discussion on the web visit > https://groups.google.com/d/msg/thinking-sphinx/-/oX6u-2OOl8EJ. > > To post to this group, send email to thinkin...@googlegroups.com<javascript:> > . > > To unsubscribe from this group, send email to > thinking-sphi...@googlegroups.com <javascript:>. > > For more options, visit this group at > http://groups.google.com/group/thinking-sphinx?hl=en.
I added some down votes to 3 users. It did put those three users to the top of the results, the problem is that the order of those 3 results is wrong. It is showing up as the order I voted on them -1, -2, -2 (-1 being the last user I voted on)
> I added some down votes to 3 users. It did put those three users to the top of the results, the problem is that the order of those 3 results is wrong. It is showing up as the order I voted on them -1, -2, -2 (-1 being the last user I voted on)
> -- > You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group. > To view this discussion on the web visit https://groups.google.com/d/msg/thinking-sphinx/-/ZACphJWXKDIJ. > To post to this group, send email to thinking-sphinx@googlegroups.com. > To unsubscribe from this group, send email to thinking-sphinx+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/thinking-sphinx?hl=en.
define_index do indexes name indexes tag_taggings.tag(:name), as: :tags has :id has view_count, as: :impressions has "COUNT(comments.id)", as: :reviews, type: :integer has "COUNT(DISTINCT votes.id)", as: :rating_count, type: :integer has "SUM(CASE votes.vote WHEN TRUE THEN 1.0 ELSE -1.0 END)", as: :rating, type: :float has "RADIANS(lat)", as: :lat, type: :float has "RADIANS(lng)", as: :lng, type: :float has created_at, updated_at group_by "lat", "lng" join comments join votes end
#PERSON CONTROLLER
conditions = {} %w(name tags).each do |i| i = i.to_sym next unless params[i] conditions[i] = params[i] end
On Friday, December 7, 2012 5:32:59 AM UTC-5, Pat Allan wrote:
> Hi Mike
> Can you share with us your full index definition?
> Cheers
> -- > Pat
> On 07/12/2012, at 5:20 AM, Mike C. wrote:
> > Also, when I filter :order => "plusminus ASC"
> > I added some down votes to 3 users. It did put those three users to the > top of the results, the problem is that the order of those 3 results is > wrong. It is showing up as the order I voted on them -1, -2, -2 (-1 being > the last user I voted on)
> > -- > > You received this message because you are subscribed to the Google > Groups "Thinking Sphinx" group. > > To view this discussion on the web visit > https://groups.google.com/d/msg/thinking-sphinx/-/ZACphJWXKDIJ. > > To post to this group, send email to thinkin...@googlegroups.com<javascript:> > . > > To unsubscribe from this group, send email to > thinking-sphi...@googlegroups.com <javascript:>. > > For more options, visit this group at > http://groups.google.com/group/thinking-sphinx?hl=en.
What happens if you remove the comments and tag references? I think it may be a case of the other joins increasing the number of records, and thus vote counts are increased for some records.
If that's the case, then things will be tricky… I'd imagine you'd need to have an association each for positive and negative votes (add a condition on the vote column), and then use the count of distinct votes.id to figure out the value…
has "CAST(COUNT(DISTINCT positive_votes.id) - COUNT(DISTINCT negative_votes.id)) as float", :as => :rating, :type => :float join positive_votes join negative_votes
I'm not entirely sure of that logic - and the join table aliases may be something other than positive_votes and negative_votes. In short: a bit of trial and error will be required.
> On Friday, December 7, 2012 5:32:59 AM UTC-5, Pat Allan wrote: > Hi Mike > Can you share with us your full index definition?
> Cheers
> -- > Pat
> On 07/12/2012, at 5:20 AM, Mike C. wrote:
> > Also, when I filter :order => "plusminus ASC"
> > I added some down votes to 3 users. It did put those three users to the top of the results, the problem is that the order of those 3 results is wrong. It is showing up as the order I voted on them -1, -2, -2 (-1 being the last user I voted on)
> > -- > > You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group. > > To view this discussion on the web visit https://groups.google.com/d/msg/thinking-sphinx/-/ZACphJWXKDIJ. > > 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.
> -- > You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group. > To view this discussion on the web visit https://groups.google.com/d/msg/thinking-sphinx/-/ESfL1edDbL4J. > To post to this group, send email to thinking-sphinx@googlegroups.com. > To unsubscribe from this group, send email to thinking-sphinx+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/thinking-sphinx?hl=en.
You're right! It appears the culprit is "indexes tag_taggings.tag(:name), as: :tags". When I remove this attribute from the index the ratings work perfect. Although I need the tags as part of the search...
My bad...I deciphered the part you mentioned "and the join table aliases may be something other than positive_votes and negative_votes" by checking out the development.sphinx config file. They were labeled as positive_votes_people and negative_votes_people. So the define index became thus:
has "CAST(COUNT(DISTINCT positive_votes_people.id) - COUNT(DISTINCT negative_votes_people.id) as float)", :as => :rating, :type => :float join positive_votes join negative_votes
On Friday, December 7, 2012 11:49:44 PM UTC-5, Mike C. wrote:
> You're right! It appears the culprit is "indexes tag_taggings.tag(:name), > as: :tags". When I remove this attribute from the index the ratings work > perfect. Although I need the tags as part of the search...
> My bad...I deciphered the part you mentioned "and the join table aliases may be something other than positive_votes and negative_votes" by checking out the development.sphinx config file. They were labeled as positive_votes_people and negative_votes_people. So the define index became thus:
> On Friday, December 7, 2012 11:49:44 PM UTC-5, Mike C. wrote: > You're right! It appears the culprit is "indexes tag_taggings.tag(:name), as: :tags". When I remove this attribute from the index the ratings work perfect. Although I need the tags as part of the search...
> define index > has "CAST(COUNT(DISTINCT positive_votes.id) - COUNT(DISTINCT negative_votes.id)) as float", :as => :rating, :type => :float > join positive_votes > join negative_votes > end
> but I keep getting an issue like:
> OR
> -- > You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group. > To view this discussion on the web visit https://groups.google.com/d/msg/thinking-sphinx/-/0JjKshHjjoUJ. > To post to this group, send email to thinking-sphinx@googlegroups.com. > To unsubscribe from this group, send email to thinking-sphinx+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/thinking-sphinx?hl=en.