match a fulltext search with a "-" dash, can't match if - exist

match a fulltext search with a "-" dash, can't match if - exist

Post by Linda T » Sat, 23 Oct 2004 05:35:55



Louie,

Mysql treats the dash as a word separator. There's no way to change
that unless you change the source code and recompile Mysql.

Also, the default min word length is 4. So not only is "E" not
matched; even "018" will not be matched. The min word length is easily
configurable, though. Put a .cnf file in the conf dir of your
installation, and have the line:

ft_min_word_len=3

and restart your mysql server. If "018" is not a common word in your
index, then it will show up as a match.

-linda



> > mysql> select * from fullsearch where match (title,body) against ('018-E');
> > Empty set (0.00 sec)

> > it returns an empty set, is it possible to also search with "-" dash? chars?

> If I remember correctly, you need to pass the string as a phrase to fulltext:

> select * from fullsearch where match (title,body) against ('"018-E"');

> I'd prefer being able to escape the - with \, since using a phrase has
> other disadvantages (like partial word matching goes out the window),
> but you can't.

> --
> Chris

> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql

 
 
 

1. match a fulltext search with a "-" dash, can't match if - exist

this is a working example i found on mysql.com

this is my example of fullsearch
mysql> desc fullsearch;
+-------+------------------+------+-----+---------+----------------+
| Field | Type             | Null | Key | Default | Extra          |
+-------+------------------+------+-----+---------+----------------+
| id    | int(10) unsigned |      | PRI | NULL    | auto_increment |
| title | varchar(200)     | YES  | MUL | NULL    |                |
| body  | text             | YES  |     | NULL    |                |
+-------+------------------+------+-----+---------+----------------+
3 rows in set (0.00 sec)

my data:
mysql> select * from fullsearch;
+----+-----------------------+-----------------------------------------------+
| id | title                 | body                                          |
+----+-----------------------+-----------------------------------------------+
|  1 | MySQL Tutorial        | DBMS stands for DataBase ...                  |
|  2 | How To Use MySQL Well | After you went through a ...                  |
|  3 | Optimizing MySQL      | In this tutorial we will show ...             |
|  4 | 1001 MySQL Tricks     | 1. Never run mysqld as root. 2. ...           |
|  5 | MySQL vs. YourSQL     | In the following database comparison ...      |
|  6 | 018-E                 | Test for Title Item COde search language, etc |
|  7 | MySQL Security        | When configured properly, MySQL ...           |
+----+-----------------------+-----------------------------------------------+

my search the title with a "-" code

mysql> select * from fullsearch where match (title,body) against ('018-E');
Empty set (0.00 sec)

it returns an empty set, is it possible to also search with "-" dash? chars?

--
Louie Miranda
http://www.axishift.com

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql

2. Printing postscript generated by dvips

3. "%" not matching "localhost" ?

4. plotting numbers on sphere.m plot

5. "Match" does not find it, but "Like" finds it

6. Upgrade from v4r4 to v5r1

7. Receiving "Table 'mysql.host' doesn't exist"

8. Widow lines - how to get rid of them

9. SQL select count(*) from "myTable" failed : Relation "mytable" does not exist

10. Join "with no matches on other table"

11. search engine (skill_id="PHP" and skill_id="JAVA")

12. Probleme avec "WHERE MATCH ... AGAINST"

13. MATCH Q,A AGAINST ("order") syntax and question???