You are here: Doing a "greedy" search on a db « PHP SQL « IT news, forums, messages
Doing a "greedy" search on a db

Posted by Andrew Poulos on 09/29/05 14:33

I have a db with table that contains a field that I've called
'mykeywords' which contains one of more comma separated words. The table
has 1,000s of rows.

The user can set up to five keywords to search through 'mykeywords' for
any matches. If the no match is found then a new search is started using
one less keyword. If that fails a different combination of keywords is
tried before dropping another keyword. For example, say if the table had
only one row and the 'mykeywords' field contained:

"house,apple,banana,chair,table,arena,ball,shelf,book"

and a search was started with:

"house,floor,mat"

the search should try (in loose order):

house,floor,mat
house,floor
floor,mat
house,mat
house
floor
mat

My problem is that I'm having trouble finding a way to do a "greedy"
search (greedy in the sense that I want the largest number of user
keywords matched) without having to iterate a factorial number of times.

Andrew Poulos

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация