我正在做一個網站,後端使用MySQL和Ruby gem Sinatra。MySQL是否有文字搜索,似乎像谷歌的工作?
我的MySQL表有LONGTEXT
列,其索引爲FULLTEXT
。
我寫了一個MySQL查詢這基本上是這樣的:
SELECT Plot
FROM myTable
WHERE MATCH(Plot) AGAINST('time travel robot')
的第一個結果:
Man on the Moon is a biographical movie on the late comedian Andy Kaufman. Kaufman, along with his role on Taxi (1978), was famous for being the self-declared Intergender Wrestling Champion of the world. After beating women time and time again, Jerry Lawler (who plays himself in the movie), a professional wrestler, got tired of seeing all of this and decided to challenge Kaufman to a match. In most of the matches the two had, Lawler prevailed with the piledriver, which is a move by spiking an opponent head-first into the mat. One of the most famous moments in this feud was in the early 80s when Kaufman threw coffee on Lawler on Late Night with David Letterman (1982), got into fisticuffs with Lawler, and proceeded to sue NBC.
雖然我很喜歡這部電影,它無關,與時間旅行或機器人。
我不知道Google的搜索算法,但是我想知道MySQL是否具有搜索功能,可以根據輸入的單詞有多緊密排列結果。
在我的情況下,我希望最相關的結果有儘可能相近的詞「時間」,「旅行」和「機器人」。
如果我的夢想功能也可以在單詞上有變化,比如「旅行」或「機器人」,那將會很好。
這對MySQL有多大可能?還是用Ruby?
或者我應該去完全不同的東西?