Reputation: 1641
I have a group index. A group has an interest (purpose for the group, it can be 'Study Group', or 'Wine Tasting') and the location where it is being organized (the lat, lon values). User also have interests (multiple).
So when a user searches groups with a keyword, I would like to score those group with matching interests and nearer to user's current location higher.
Using filter queries and geospatial search is limiting the results to matching interests and the distance supplied in the query. For example if you search for "ABC Group", and there is no group matching any of your interests then I am getting blank result.
What I want is, return all the matching groups with the search term but score the groups matching user's interest and nearest to user higher. How do I do it? Any relevant portion from the docs would be helpful too.
Upvotes: 0
Views: 285
Reputation: 9320
One naive approach that I could think of is following:
Let's say you have query, where title:ABC group
, sorting by distance is obvious, but you need to somehow place groups with user's interests higher than others. You could do that by adding all user's interests as set of should clauses (so they will not filter out additional groups with different interests). Also you could try to apply some boosting (coefficients should be selected carefully) for these clauses:
interest:wine^5 OR interest:study^5 OR
.... etc
Upvotes: 1