Jump to content


Photo

MATCH query


  • Please log in to reply
2 replies to this topic

#1 neugi

neugi
  • Members
  • PipPipPip
  • Advanced Member
  • 63 posts

Posted 21 August 2006 - 08:50 AM

Hi,

i've written this query:
SELECT h.id, h.kbeschreibung, hf.text
FROM hauser AS h
LEFT JOIN haus_fertigarten AS hf ON h.id = hf.hid
WHERE MATCH (h.kbeschreibung, hf.text) AGAINST ('Loretto' IN BOOLEAN MODE)

with this i get no result

if i use it like this it works
SELECT h.id, h.kbeschreibung, hf.text
FROM hauser AS h
LEFT JOIN haus_fertigarten AS hf ON h.id = hf.hid
WHERE MATCH (h.kbeschreibung) AGAINST ('Loretto' IN BOOLEAN MODE) OR MATCH (hf.text) AGAINST ('Loretto' IN BOOLEAN MODE)

maybe somebody can tell me why my first don't work

thx


#2 shoz

shoz
  • Staff Alumni
  • Advanced Member
  • 600 posts

Posted 21 August 2006 - 09:05 AM

To perform the first query you need to have a FULLTEXT index on both columns in the order supplied to MATCH
ie
ALTER TABLE tablename ADD FULLTEXT(col1,col2);
However, since the two columns are in different tables I don't think you can do that.

#3 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 21 August 2006 - 05:36 PM

Yeah, you can't have an index that spans tables.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users