I am trying to implement search functionality in my laravel app. Angolia is not preferred by my supervisors due to data security problems. Other than that one good option is to implement elastic search and another is to use full text search from mysql. I am not sure what are the pros and cons and although I have read in a few places that elastic search should be the better alternative, I would like to understand what I am working with since I haven't worked with searching before this.
I am looking at MySQL requirements and it seems I can only implement it with 5.6 or above with InnoDb engine. And other than that I can only implement fulltext indexes on char and text type fields. I am not sure what kind of fields are permitted in Elastic search.
I know I have to something like:
DB::statement('ALTER TABLE posts ADD FULLTEXT search(title, body)');
Then I guess I do something like:
SELECT * FROM posts
WHERE MATCH (title, body)
AGAINST ('foo' IN NATURAL LANGUAGE MODE);
Is there Eloquent implementation for this or do I have to do this manually using the DB facade? If there isn't a Eloquent implementation, are there 3rd party packages with this functionality?
除此之外,我还需要搜索相关的表格,比如 comments 和标签等等.如何在表之间创建索引,还是不可能?如果在MySQL中无法跨表创建索引,那么ES中有什么可以克服的地方吗.
使用MySQL全文搜索与Elastic search 相比,我可能面临的其他利弊是什么?