Skip to content
Snippets Groups Projects
Commit bb223217 authored by felixwelter's avatar felixwelter
Browse files

Add index which favours slides with the query in the title/first line

parent ab4992d5
No related branches found
No related tags found
No related merge requests found
from search_index import BasicSearchIndex
class TitleFocusSearchIndex(BasicSearchIndex):
"""Return fitting slides, favouring slides with the query contained in the title"""
def search(self, query):
results = self.result_list(query)
for result in results:
if query.lower() in result["content"].split("\n")[0].lower():
return result
return results[0]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment