Hi there,

I had a similar problem wanting to match 'words' like "42.3.1.1" as
technical references.  I couldn't get them to match using a fulltext index,
I assume because the full stops are used by the parser in MySql to break the
text into words for indexing - maybe this is the same for the slashes.  I've
considered changing the full stops to underscores as I add the text to the
database, or re-coding the function that does the splitting - I think I
found the function, but it is quite hard to penetrate :-/

Thanks,

Mike

> -----Original Message-----
> From: Jason Ramsey [mailto:[EMAIL PROTECTED]
> Sent: 13 November 2003 22:11
> To: [EMAIL PROTECTED]
> Subject: Backslash and full text searches
>
>
> We make extensive use of full text searches, but have run into
> some problems
> with backslashes.  If a word like "somebody's" is entered into
> our database,
> we escape the string using "mysql_escapes_string" in php.  So,
> mysql_escape_string("somebody's") becomes "somebody\'s" when it
> is saved in
> the database.  The problem is, we don't seem to be able to match against
> this in the database.
>
> Let's say we saved "somebody's" in the data base.  The following
> will match
> fine and pull up the results expected...
>
> SELECT * FROM Table WHERE MATCH (Field) AGAINST ("somebody's")
>
> .... But if "somebody\'s" is stored in the database, there seems
> to be no way
> to match the "\".  We've tried all of the following...
>
> SELECT * FROM Table WHERE MATCH (Field) AGAINST ("somebody's")
> SELECT * FROM Table WHERE MATCH (Field) AGAINST ('somebody's')
> SELECT * FROM Table WHERE MATCH (Field) AGAINST ('"somebody's"')
> SELECT * FROM Table WHERE MATCH (Field) AGAINST ("somebody\'s")
> SELECT * FROM Table WHERE MATCH (Field) AGAINST ('somebody\'s')
> SELECT * FROM Table WHERE MATCH (Field) AGAINST ("somebody\\\'s")
> SELECT * FROM Table WHERE MATCH (Field) AGAINST ('somebody\\\'s')
> SELECT * FROM Table WHERE MATCH (Field) AGAINST ('"somebody\'s"')
> SELECT * FROM Table WHERE MATCH (Field) AGAINST ('"somebody\\\'s"')
>
> .... Any ideas?
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]
>
>
>
>



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to