On Tuesday 28 July 2009 12:01:06 adam wrote:
> i have now added in a for loop that splits the search sting down into
> seperate word
>
>
> word = info
>             words = word.split()
>             results = []
>
>             for w in words:
>                 search_string = "%%%s%%" % str(w)
>                 clause = []
>                 abc = AddressBookContact
>                 for column in (abc.contact_surname,
> abc.contact_email,abc.contact_forename,abc.contact_address1,abc.contact_add
>ress2,
>
> abc.contact_street,abc.contact_town,abc.contact_county,abc.contact_postcode
>,abc.contact_country,abc.contact_telephone, abc.contact_mobile):
>                     clause.append(column.like(search_string))
>                 forename = DBSession.query(AddressBookContact).filter
> (or_(*clause))
>                 results.append(forename)
>
>
> i have searched the list for repeating users and removed them. Is this
> more efficient?

I think it's better to combine the search-fields with or to *one* 
SQL-statement. Otherwise, you won't get global ordering.

Diez


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to