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_address2,
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?
On Jul 28, 10:32 am, adam <[email protected]> wrote:
> Thanks for the help on that, seems to work much better. The problem i
> am facing now is this
>
> If i search for the surname "smith" i get a result fine. But if
> someone searches for "adam smith" nothing is returned. Is there away
> to search an entire database table and return any similar match. So if
> someone did search for Adam Smith they would get a result
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---