search: only match pn against search string for recipe searches
PATCH 1/1 search: only match pn against search string for recipe searches
Using the search box creates a query against the pns, summaries, descriptions and filenames of recipes. This results in a lot of spurious results for common terms like "git" when performing a recipe search.
Reduce the search fields used to just the pn so that the search will only return results where the recipe name matches.
[YOCTO #9159]
--- layerindex/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
layerindex/views.py +2 -2
@@ -373,7 +373,7 @@ class RecipeSearchView(ListView): query_string = self.request.GET.get('q', '') init_qs = Recipe.objects.filter(layerbranch__branch__name=self.kwargs['branch']) if query_string.strip(): - entry_query = simplesearch.get_query(query_string, ['pn', 'summary', 'description', 'filename']) + entry_query = simplesearch.get_query(query_string, ['pn']) qs = init_qs.filter(entry_query).order_by('pn', 'layerbranch__layer') else: if 'q' in self.request.GET:
@@ -689,7 +689,7 @@ class ClassicRecipeSearchView(RecipeSearchView): if category: init_qs = init_qs.filter(classic_category__icontains=category) if query_string.strip(): - entry_query = simplesearch.get_query(query_string, ['pn', 'summary', 'description', 'filename']) + entry_query = simplesearch.get_query(query_string, ['pn']) qs = init_qs.filter(entry_query).order_by('pn', 'layerbranch__layer') else: if 'q' in self.request.GET:
Signature · 12 lines
1.9.3 --------------------------------------------------------------------- Intel Corporation (UK) Limited Registered No. 1134945 (England) Registered Office: Pipers Way, Swindon SN3 1RJ VAT No: 860 2173 47 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
Quoted 7 lines · On 18/03/2016 16:12, "[email protected] on behalf of Elliot…
Using the search box creates a query against the pns, summaries, descriptions and filenames of recipes. This results in a lot of spurious results for common terms like "git" when performing a recipe search.
Reduce the search fields used to just the pn so that the search will only return results where the recipe name matches.
Just a thought: searching the descriptions and layer names has certain advantages. Sometimes you might not know the exact name of the recipe you are looking for (what if I am just looking for a small image? Or a development image? Or an image for the raspberry pi?).
I think the issue is with the ordering of the search results (a simple alphabetical), and not so much with the fields being searched: that's what I think we need to refine so that we show first results where recipe names start with the search auery string, sorted in alphabetical order, then all other results, also in alphabetical order.
Cheers
Belén
Quoted 55 lines
[YOCTO #9159]
Signed-off-by Elliot Smith <[email protected]>---
layerindex/views.py| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)layerindex/views.py +1
-1@@ -373,7 +373,7 @@ class RecipeSearchView(ListView): query_string = self.request.GET.get('q', '') init_qs = Recipe.objects.filter(layerbranch__branch__name=self.kwargs['branch']) if query_string.strip(): - entry_query = simplesearch.get_query(query_string, ['pn', 'summary', 'description', 'filename']) + entry_query = simplesearch.get_query(query_string, ['pn']) qs = init_qs.filter(entry_query).order_by('pn','
layerbranch__layer')
else:
if 'q' in self.request.GET:layerindex/views.py +1
-1@@ -689,7 +689,7 @@ class ClassicRecipeSearchView(RecipeSearchView): if category: init_qs = init_qs.filter(classic_category__icontains=category) if query_string.strip(): - entry_query = simplesearch.get_query(query_string, ['pn', 'summary', 'description', 'filename']) + entry_query = simplesearch.get_query(query_string, ['pn']) qs = init_qs.filter(entry_query).order_by('pn','
layerbranch__layer')
else:
if 'q' in self.request.GET:Signature · 18 lines
1.9.3 --------------------------------------------------------------------- Intel Corporation (UK) Limited Registered No. 1134945 (England) Registered Office: Pipers Way, Swindon SN3 1RJ VAT No: 860 2173 47 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. -- _______________________________________________ yocto mailing list [email protected] https://lists.yoctoproject.org/listinfo/yocto