teamtnt / tntsearch

A fully featured full text search engine written in PHP
https://tnt.studio/solving-the-search-problem-with-laravel-and-tntsearch
MIT License
3.1k stars 291 forks source link

Searching multiple models in Laravel and ranking them #135

Open TheBigK opened 6 years ago

TheBigK commented 6 years ago

I've not been able to find any tutorial or guide that shows how to search multiple models together, with a query. In my application, I've a 'Thread' model and a 'Reply' model. When a user performs search, I need to search $thread->title, $thread->body and $reply->body.

But then, I need to rank the results with relevance starting with the title, thread body and then reply-body.

Would really appreciate if someone could give me a pointer in the right direction. Have already scratched my head a lot on this.

ultrono commented 6 years ago

Sure you'd get a better response in the Scout driver repo at https://github.com/teamtnt/laravel-scout-tntsearch-driver