Use subtitle name in search results (#10814)

This commit is contained in:
Martin Liška 2022-09-13 10:26:49 +02:00 committed by GitHub
parent ded734d5f9
commit c4964edc73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -378,7 +378,7 @@ class IndexBuilder:
alltitles: Dict[str, List[Tuple[int, str]]] = {}
for docname, titlelist in self._all_titles.items():
for title, titleid in titlelist:
alltitles.setdefault(title.lower(), []).append((fn2index[docname], titleid))
alltitles.setdefault(title, []).append((fn2index[docname], titleid))
return dict(docnames=docnames, filenames=filenames, titles=titles, terms=terms,
objects=objects, objtypes=objtypes, objnames=objnames,

View File

@ -280,12 +280,12 @@ const Search = {
const queryLower = query.toLowerCase();
for (const [title, foundTitles] of Object.entries(allTitles)) {
if (title.includes(queryLower) && (queryLower.length >= title.length/2)) {
if (title.toLowerCase().includes(queryLower) && (queryLower.length >= title.length/2)) {
for (const [file, id] of foundTitles) {
let score = Math.round(100 * queryLower.length / title.length)
results.push([
docNames[file],
titles[file],
title,
id !== null ? "#" + id : "",
null,
score,