You are here: Re: Full Text Search - Custom Query Expansion? « PHP SQL « IT news, forums, messages
Re: Full Text Search - Custom Query Expansion?

Posted by www-onebigspace-com on 04/08/07 15:50

Yes, you could replace a single word with a set ....

function clean_phrase_input($input){

$string = strtolower(htmlspecialchars($input));
$patterns[0] = "cat"; $replacements[0] = "cat kitten deadcat";
$patterns[1] = "woman"; $replacements[1] = "gal girl";
$patterns[2] = "boy"; $replacements[2] = "guy young-guy";

$phrase = str_replace( $patterns, $replacements, $string

);
return $phrase;
}

Or you could create a table that has a keyword and links multiple
synonyms.

On Wed, 28 Mar 2007 12:02:36 GMT, "James A" <me@privacy.net> wrote:

>Hi,
>
>
>
>I want to allow full text search of a row in a table (MySQL v3.23). I
>understand that the WITH QUERY EXPANSION clause adds ability for results to
>be returned even where the match is not exact, misspellings, and some
>equivalences.
>
>
>
>However, I would like to specify somehow sets of equivalent words, so for
>example a search for "cat" would return a row containing the word "cat",
>"kitten" or "animal". The database is not large (300 rows with average of
>100 words per row) and it is specialized so this list would not be huge.
>
>
>
>Is there a way to customize the MySQL query expansion to add these
>alternative words? I do not have access to the source, so I don't expect so.
>
>
>
>Otherwise, could someone please suggest a way it could be performed? My
>thoughts are to construct a table of equivalent words, and then use code to
>expand the search string before performing the search, so that e.g.
>
>
>
>SELECT * FROM table WHERE MATCH (row) AGAINST ('cat')
>
>
>
>would become
>
>
>
>SELECT * FROM table WHERE MATCH (row) AGAINST ('cat kitten animal')
>
>
>
>However, I want to lsit the results in terms of relevance and I think that
>would return badly weighted results - rows with more than one word in the
>search phrase would be classed as more relevant than those with just one,
>whereas I am trying to make the words equivalent to each other. (I also want
>to do the same with phrase matching which could complicate it further
>maybe.)
>
>
>
>Many thanks in advance to anyone who has any ideas or has done such a thing
>already.

 

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

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