Yes, I did search first (plus google), does anybody know of a search algorithm in PHP which I can use to search records based on english language searches (like a search engine)? Any good references to approaches perhaps?

For example, you can match a string based on an exact string, subsets of words matching, or pairs of words matching in reasonable proximity, especially in the same order. You can also weight relevance based on what matches are in the title, what are in the desription, what are in the body, etc.

I could do this but this is one time I don't want to re-invent the wheel.

Sam

    Excellent resources, paydirt really.

    For general undersanding drew010, could you give me your feedback on this? My thinking is that you really can't put this all on the database, so you need to query through records, then parse on the PHP end, assign a relevance if desired, and then quit when you have x number of relevant matches.

    In other words, I'm leery of doing this:

    SELECT * from table WHERE relevance_above_x ORDER BY relevance_above_x DESC

    Or, in other words, this would mean you'd need to run the algorithm in the query. The flip side dilemma is you'd consistently miss some records unless you go through them all.

    Any feedback? Much appreciated.
    Sam

      you will probably have to pull the data from the database. my guess would be to run a sort of query like select sometext from table to get allll entries. then loop thru each doing a strstr() check or something to find simiar words. however i have never had to implement something like this before so im not sure the best way. sorry i couldnt be more help.

        Write a Reply...