Hello,
I have this:

  define_index do
    indexes :name, :sortable => true
    indexes description
    indexes hashtags
    indexes tag(:name), :as => :tag, :sortable => true
    indexes comments.comment, :as => :comment

    has state, :type => :string
    has user_id, created_at, updated_at, tag_id, box_id
    has "RADIANS(latitude)",  :as => :latitude,  :type => :float
    has "RADIANS(longitude)", :as => :longitude, :type => :float

    group_by "latitude", "longitude"
  end

`state` is a string, I'm trying to build a scope that returns items with 
only two particular states:

  sphinx_scope(:for_public_sphinx) {
    {
      :conditions => {
        :state => ['public', 'on_sale']
      }
    }
  }

controller:

      search_options = { page: params[:page] || 1, per_page: 40, 
match_mode: :any, star: true }
      ...
      @items = Item.for_public_sphinx.search(params[:q], search_options)

But I can't make it return the correct items, I tried also with `with` 
instead of conditions, changing the match_mode to extended, use directly 
state as `indexes` but I get mixed results or sometimes errors.

With the configuration above I get items matching my search query, but also 
items with state private.

Any pointers are appreciated, thanks.

-- 
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/-/kc2l8R9MflsJ.
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