Hi Steve

James' suggestion is perfect if you want to exclude records that  
aren't public from all searches.

However, it sounds like you may want to exclude certain fields  
depending on whether the user has their profile marked as public or  
not. This isn't built-in to Sphinx or Thinking Sphinx, but you should  
be able to achieve it using something like the following:

   define_index do
     indexes "IF(public = 1, location, '')", :as => :location
     # repeat for relevant fields
   end

Hope this helps.

-- 
Pat

On 10/06/2009, at 8:53 PM, James Healy wrote:

>
> steve wrote:
>> I have some fields that belong to users that I would like to be
>> indexable.  However there are preferences for that user to make that
>> information public or not.  I'm trying to figure out how to only
>> include the attribute in the index if it was it's public for that
>> record.
>
> assuming you have a database column called public, try:
>
>    define_index do
>      ...
>      ...
>
>      where "public = 1"
>    end
>
> -- James Healy <jimmy-at-deefa-dot-com>  Thu, 11 Jun 2009 10:51:03  
> +1000
>
> >


--~--~---------~--~----~------------~-------~--~----~
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