1

I'm using a match against query in boolean mode to create a search feature. The search works, and returns results how I would expect them to, except that there is one problem with words with apostrophes in them.

If there is a word saved on the database with an apostrophe in it (pirate's for example) and you search for the word with the apostrophe in it, or without the end of the word (pirate's or pirate for example) it returns results, however if i search the word without the apostrophe (pirates) it returns no results.

I've tried changing the record in the database to be escaped and not escaped, and I can't seem to find a way to fix it.

I have also spend a while searching for simular answers, but none have the same problem as this, they seem to be more about returning results for a search without the apostrophe and the s.

My query is:

SELECT * FROM flyer WHERE MATCH(band, venue, promoter) AGAINST('$search' IN BOOLEAN MODE)
Matt
  • 6,993
  • 4
  • 29
  • 50
George
  • 280
  • 3
  • 10
  • because i'm using php to perform the mysql query, and thought that people knowledgeable about php would be able to help with the mysql. Is this wrong? – George Aug 03 '12 at 15:19
  • 1
    Yes. Your question is in reference to MySQL. Just because you're *using* one technology, that doesn't mean your question is relevant to that technology. For example, you could be using a GUI such as MySQL Administrator to do what you're doing, but you wouldn't tag "MySQL Administrator" because the question refers to MySQL, not the tool being used. – Matt Aug 03 '12 at 15:22
  • No problem, just a heads-up. Some people get upset over things like that. – Matt Aug 03 '12 at 15:36
  • What you provided isn't the actual query that's being sent to mySQL because it still has your PHP variable; What does your query look like when you var_dump() it? Does it work correctly in phpMyAdmin (outside of PHP)? I'm learning boolean searching right now and have tried searches with apostrophes - and without - on varchar fields and have received results on each query. – timgavin Sep 02 '13 at 00:43

0 Answers0