Never mind, user error. Turns out I had a rogue sphinx process running on the system, so none of my index rebuilds were affecting the process actually responding to my queries.
On Dec 17, 4:55 pm, Jonathan Block <[email protected]> wrote: > I've been working with TS for just a few days now, but thanks to your > great work and the good documentation out there, it was all pretty > easy to get set up. Until I tried to add attributes to filter search > results based on access permissions, that is. > > I've seen multiple similar examples focused around creating a > multivalue string attribute based on authorized user IDs (or "0" for > public items), and I thought I was following the guidance completely. > Yet, every time I apply a filter that should allow the majority of the > records through (i.e. :with => {:authorized_ids => [0]} on a largely > public data set), I get 0 results. I've tried every permutation I can > think of in place of the [0] entry, and I've tried swapping :with > for :without, with no improvement. > > The relevant code is below. Rails 3.0.3, recent version of Sphinx, > thinking-sphinx gem 2.0.1. > > Am I 'Doing It Wrong'? > > -- > [app/models/project.rb] > class Project < ActiveRecord::Base > has_many :project_acls > has_many :users, :through => :project_acls > define_index do > ... > has project_acls(:id), :as => :acl_ids, :type => :multi > has "IF(projects.private = 0, '0', > GROUP_CONCAT(project_acls.user_id SEPARATOR ','))", > :as => :authorized_ids, > :type => :multi > ... > end > end > -- > > I have confirmed that the SQL query generated by TS and stored in the > config file actually produces the expected values for the > 'authorized_ids' field, though I don't know how to test for that value > in the Sphinx indexes. Most rows would have a value of '0', while a > few have a value of '1' and one is '1,2' (where 1 and 2 are valid User > ids). 5 is a valid ProjectAcl id. > > -- > [rails console] > Project.search.total_entries > => 31 > Project.search( :with => {:acl_ids => [5]} ).total_entries > => 0 > Project.search( :without => {:acl_ids => [5]} ).total_entries > => 0 > Project.search( :with => {:authorized_ids => [0]} ).total_entries > => 0 > Project.search( :without => {:authorized_ids => [0]} ).total_entries > => 0 > Project.search( :with => {:authorized_ids => [1]} ).total_entries > => 0 > [etc.] > -- > > I don't think my YML settings are relevant, but just in case, here's > what I'm using: > > -- > [sphinx.yml] > development: > morphology: stem_en > enable_star: true > min_infix_len: 3 > -- > > Again, any pointers or useful directed questions would be quite > welcome. > > Thanks, > -Jonathan -- 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.
