From 9a06d44341c05574c425441420a60e9de3e1be17 Mon Sep 17 00:00:00 2001 From: Samuel Clay Date: Thu, 30 Jul 2015 16:36:06 -0700 Subject: [PATCH] Matching full URLs when searching for a feed. --- apps/search/models.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/search/models.py b/apps/search/models.py index 4a7aaf860..b5c6b77fb 100644 --- a/apps/search/models.py +++ b/apps/search/models.py @@ -395,7 +395,10 @@ class SearchFeed: return [] logging.info("~FGSearch ~FCfeeds~FG: ~SB%s" % text) - q = pyes.query.MultiMatchQuery(['address', 'link^2', 'title^3'], text, analyzer="standard") + q = pyes.query.BoolQuery() + q.add_should(pyes.query.MatchQuery('address', text, analyzer="simple", cutoff_frequency=0.0005, minimum_should_match="50%")) + q.add_should(pyes.query.MatchQuery('link', text, analyzer="simple", cutoff_frequency=0.0005, minimum_should_match="50%")) + q.add_should(pyes.query.MatchQuery('title', text, analyzer="simple", cutoff_frequency=0.0005, minimum_should_match="50%")) results = cls.ES().search(query=q, size=5, doc_types=[cls.type_name()], sort="num_subscribers:desc") return results