Just a quick update...

i was able to change the requirements so it's easier to implement the
search with TS/Sphinx :-)

But i had another idea which would allow you to keep sphinx sorting/
ordering:
 * add the user ID as an attribute (something like "has
('users.id', :as => :user_id)" )
 * use several search_for_ids(), probably set the per_page option to a
higher value
 * merge those IDsto a single array, may be uniq! it
 * search again, filter for those IDs, applay sorting as requested


Pascal



On Feb 19, 6:26 am, Pat Allan <[email protected]> wrote:
> Hi Pascal
>
> I've heard of others using search_for_ids to get around the pagination  
> stuff - I'm not sure how they did it though. So maybe that's an  
> option. Beyond that, I'm not much help, sorry.
>
> Good luck!
>
> --
> Pat
>
> On 17/02/2009, at 8:15 PM, pascal wrote:
>
>
>
> > And if i build a query similiar to this:
> > "firstname:whatever OR (lastname:whatever AND (friend_ids:99 OR
> > privacy:0)) OR description:whatever"
>
> > (User with ID 99 is searching for "whatever", privacy = 0 -> privacy
> > disabled, privacy = 1 -> privacy enabled)
>
> > Otherwise i see following options:
> > - stick with what we have now (lots of LIKE staments, will not scale
> > as soon as we have more users and more text to search and does not
> > offer weights, facets and so on)
> > - use several queries and then merge the results
> > - filter the results after the are returned by TS and try to get
> > pagination working. maybe search_for_ids is the way to go here...
> > pagination would then involve only messing with a list if Integers
> > - try the named scope thing Alex proposed (and again... get pagination
> > to work)
>
> > Pascal
>
> > On Feb 17, 9:11 am, Pat Allan <[email protected]> wrote:
> >> Oh, misunderstanding on my part.
>
> >> I'm afraid I can't think of a way to do that using Sphinx... you can
> >> only limit the records returned, not the text that is compared  
> >> against
> >> in each record (on a case-by-case basis, that is).
>
> >> Unless there's other clever minds on this list who can think of a  
> >> way?
>
> >> --
> >> Pat
>
> >> On 17/02/2009, at 6:37 PM, pascal wrote:
>
> >>> Pat
>
> >>> I had a look at your example but I'm not sure it does excactly  
> >>> what i
> >>> need....
> >>> The privacy check should only be applied to the "Lastname" attribute
> >>> of the user model, not to "description" and "firstname".
>
> >>> How can i achieve something like that?
>
> >>> Thanks
>
> >>> Pascal
>
> >>>>>>>>> # This will match 0 for public users, and the user id for
> >>>>>>>>> private
> >>>>>>>>> users
> >>>>>>>>> User.search "whatever", :with => {:user_limit => [0, user.id]}
>
> >>>>>>>>> Give that a shot.
>
> >>>>>>>>> Cheers
--~--~---------~--~----~------------~-------~--~----~
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