Hello.
I have two questions that I have doubts - before I make it:
-
if I have a search collection that is dug out from multiple tables, and that collection will be used in multiple views and some other purposes, should I leave it as a collection and toss it around, or should I make model for that search and have collection of that model?
-
Json field in table has single word, multiple values. Search goes well with "whereJsonContains" but, how can I get which of the result has most matches? Example:
searching for ["Apples", "Oranges", "Potatoes"]
1, ["Apples", "Strawberries", "Potatoes", "Mushrooms"]
2, ["Apples", "Mushrooms"]
3, ["Apples", "Oranges", "Potatoes", "Mushrooms", "Raspberries"]
Result should be 3 - 3 matches, 1 - 2 matches, 2 - 1 match
(or 3 - 100%, 1 - 66%, 2 - 33%) whatever, but you get the idea.