Hey Pascal,

You could use a named_scope, e.g.,  
User.publicly_visible.search(conditions), but then you'd have to  
manually do pagination on the results, like  
User.publicly_visible.search(conditions).paginate(:per_page =>  
10, :page => 1) - there may be performance problems with this, I don't  
know if
ActiveRecord lazily loads the rest of the User table columns or what,  
but I'm using a similar approach with chained named scopes and it  
seems to perform admirably so far.

Hope this helps!

On Feb 14, 2009, at 2:37 PM, pascal wrote:

>
> Hi
>
>
> I want to convert a search system (just SQL queries) to sphinx/TS and
> have some troubles, and i hope someone can help me.
>
> The aim is to search users by first/lastname and a description text
> field. A user has many friends. Depending on the users privacy
> settings his visibility in the search by first/lastname is restricted
> to his friends or to everyone. Search by description is never
> restricted.
>
> Maybe an example can clear things up:
> User "Santa Claus" has "search privacy" turned on. If you are a friend
> you can still find him by the search "Santa". If you aren't a friend,
> then you can't find him with "Santa" but with "Christmas" because
> "Christmas" appears on a his description text.
>
> So it something like "find users where search terms matches AND
> (privacy off OR privacy on AND his ID is in in the list of my friends
> ids)".
>
> I got simple search up and running real quick but is Sphinx/TS the
> right tool for this? How would i go about this?
>
>
> Thanks for your help!
>
> Pascal
>
>
>
>
>
>
>
>
> >


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