I'm using mysql 5.7 and am having trouble using a wildcard character in a fulltext query.
I want to use the search phase "cleft palate" and have it also include matches for the plural version "cleft palates".
The 2 queries below return the same exact results:
select *
from contents
where match(contents.content) against('+("cleft palate")' in boolean mode)
And
select *
from contents
where match(contents.content) against('+("cleft palate*")' in boolean mode)
Note the wildcard (*)
Both these query are leaving out results for "cleft palates"
Is there a way to use the wildcard character within a phrase in a fulltext query?
Related
I am creating a search service using mysql's fulltext-index.
I use it by setting innodb_ft_min_token_size = 1. (Support 1 character search)
The reason for the change from ngram is that ngram=1 takes too much load because there is a lot of data.
Here's a question.
If the name is 'ABCDEF' and the search keyword is 'ABC'
SELECT * FROM SEARCH_TABLE WHERE MATCH(NAME) AGAINST('+*ABC*' IN BOOLEAN MODE);
The above query finds 'ABCDEF' normally.
SELECT * FROM SEARCH_TABLE WHERE MATCH(NAME) AGAINST('+*ABC* +*DEF*' IN BOOLEAN MODE);
But this query doesn't find 'ABCDEF'.
What could be the reason and how can I fix this?
The MySQL version is 5.1.40
The table is MyISAM(only changed the table to MyISAM)
The type of table_column(name) is varchar
When I apply the fullText search, it doesn't work.
Below sql only return data 'eeee', will not return such as 'eeeefff' or 'ffeeee'
select name from test where match(name) against('eeee' in boolean mode);
MySQL's full text search lets you search for keywords beginning, but not ending, in a certain substring. So, to find all words beginning with eeee we can try:
SELECT name
FROM test
WHERE MATCH(name) AGAINST('eeee*' IN BOOLEAN MODE);
I' trying to write a MYSQL query which looks for a string in an aggregation of fields.
The following query finds all the concatenations where "io sono" is present:
SELECT chapter, GROUP_CONCAT(text_search) AS aggregated_chapters
FROM bible_it_cei_2008
GROUP BY chapter
HAVING aggregated_chapters LIKE '%io sono%';
However, trying to use MATCH... AGAINST instead of LIKE:
SELECT chapter, GROUP_CONCAT(text_search) AS aggregated_chapters
FROM bible_it_cei_2008
GROUP BY chapter
HAVING MATCH ( aggregated_chapters ) AGAINST ( '+"io sono"' IN BOOLEAN MODE);
returns the error:
#1210 - Incorrect arguments to MATCH
Isn't there any way to use MATCH AGAINST with GROUP_CONCAT?
Isn't there any way to use MATCH AGAINST with GROUP_CONCAT?
No. That's not the way FULLTEXT search works in MySQL.
If your table contains the columns chapter and text_search, and you hope to find the values of chapter matching text search, you want something like this.
SELECT chapter,
MATCH(text_search) AGAINST ('+"io sono"' IN NATURAL LANGUAGE MODE) AS score
FROM bible_it_cei_2008
To get this to work you'll need to create an appropriate FULLTEXT index.
I have a MyISAM table named links. It has a column searcher which has a FULLTEXT index to it.
This is my variable values:
ft_min_word_len = 1
ft_stopword_file =
ft_max_word_len = 84
I need to match the rows which contain both [show] & [1] in any order.
I run this query:
SELECT * FROM links WHERE MATCH(searcher) AGAINST('+[show] +[1]' IN BOOLEAN MODE)
But it is also matching the rows that don't contain [1] string. Whats the problem?
It seems that you have to make clear that the brackets are part of the search string and not part of syntax for grouping expressions.
This query should work for you:
SELECT * FROM links WHERE MATCH(searcher) AGAINST('+"[show]" +"[1]"' IN BOOLEAN MODE)
Here are some sample fiddles:
not working
working
I have the following MySQL query:
SELECT title, description
FROM some_table
WHERE MATCH (title,description) AGAINST ('+denver (REGEXP "[[:<:]]colorado[s]*[[:>:]]")' IN BOOLEAN MODE);
the "regexp" here looks for a "complete word" colorado (with or without the ending "s").
I want to actually select only those rows that have ("denver") AND ("colorado" or "colorados"). But I cannot put a "+" for the REGEXP. I tried but got 0 results, although there are rows in the table that match the requirement.
Any ideas on how I can get the "+" to work within against using a REGEXP?
I am constructing this from within a PHP script where "denver" and "colorado" are values of variables I use to construct the select statement.
My PHP/MySQL script would look somewhat like this:
SELECT title, description
FROM some_table
WHERE MATCH (title,description) AGAINST ('+$var1 (REGEXP "[[:<:]]$var2[s]*[[:>:]]")' IN BOOLEAN MODE);
I don't think it's possible to combine regular expressions and MATCH ... IN BOOLEAN MODE. You need to use the syntax for writing boolean expressions.
Boolean Full-Text Searches
Try something like this:
SELECT title, description
FROM some_table
WHERE MATCH (title,description)
AGAINST ('+denver +(colorado colorados)' IN BOOLEAN MODE);