您将如何实现自定义搜索引擎?自定义搜索引擎
你怎么看待这样的事情是什么:
SELECT *
FROM jobs
WHERE job_id IN (
SELECT job_id
FROM job_words
WHERE word_id IN (SELECT word_id FROM words w WHERE text = 'carpenter'))
AND job_id IN (
SELECT job_id
FROM job_words
WHERE word_id IN (SELECT word_id FROM words w WHERE text = 'buildings'))
或本:
SELECT j.*
,s.matches
FROM jobs as j INNER JOIN
(SELECT jw.job_id, count(*) as matches
FROM job_words AS jw
INNER JOIN (SELECT word_id FROM words w WHERE text IN ('carpenter', 'buildings')) AS w ON w.word_id = jw.word_id
GROUP BY jw.job_id) as s ON s.job_id = j.job_id
对于什么数据库? – 2010-10-16 17:08:35
没关系。我正在考虑创建自己的搜索方式,而不是使用内置函数的数据库。 – Eduardo 2010-10-16 17:27:38
实际上,它确实 - “SQL”代表“结构化查询语言”,而不是“标准化”。据我所知,全文搜索(FTS)不是ANSI--你必须使用像Sphinx这样的第三方FTS工具才能在数据库之间进行移植。字符串函数在数据库之间也没有标准化,所以祝你好运! – 2010-10-16 17:35:14