Reputation: 2039
I want to perform fulltext search for a given phrase in a given string using PHP.
I want this search to be:
Can you help me? ...I am sorry for creating new post, I've searched a lot, before I asked. However, I found only posts that concerned with PHP+MySQL search.
Upvotes: 1
Views: 5223
Reputation: 1493
How MYSQL Full-Text Search work is complex compared to PHP preg match. For example, stop words are considered in MYSQL full text search.
If you only need to depend on PHP, (and no libraries) you will need to do some development. Here's a popular library created like that.
Upvotes: 2
Reputation: 1191
For full text search i know 2 common solutions:
So, if you have InnoDB table, you must copy searchable info into MYISAM table (for example use triggers)
Upvotes: 0
Reputation: 49
You have to remove diacritics from string and then need to use preg_match
<?php
// The "i" after the pattern delimiter indicates a case-insensitive search
if (preg_match("/php/i", "PHP is the web scripting language of choice.")) {
echo "A match was found.";
} else {
echo "A match was not found.";
}
?>
PHP documentation: http://php.net/manual/en/ref.pcre.php
Upvotes: 1