對不起已故的後續,但不是你做一個笛卡爾加入對那些三個表?
SELECT Artist.* FROM Artist, Band, Instrument WHERE MATCH (Artist.name) AGAINST ('mysearchterm') OR MATCH (Band.name) AGAINST ('mysearchterm') OR MATCH (Instrument.name, Instrument.description) AGAINST ('mysearchterm');
假設數據庫中有100個樂隊,10個樂器和500位藝術家,您將通過500,000行搜索。
我希望看到類似假設你有一個數據庫,在那裏藝術家屬於一個樂隊,玩一種樂器:
SELECT Artist.* FROM Artist, Band, Instrument WHERE Artist.band_id = Band.id and Artist.instrument_id = Instrument.id and (MATCH (Artist.name) AGAINST ('mysearchterm') OR MATCH (Band.name) AGAINST ('mysearchterm') OR MATCH (Instrument.name, Instrument.description) AGAINST ('mysearchterm'));
來源
2010-10-29 21:31:53
GSP
+1使用外部引擎,無論是獅身人面像或其他任何東西(Lucene的?也有商業工具,順便說一句) – 2009-08-24 21:05:58