add score to full text search

This commit is contained in:
Simon 2023-09-04 20:44:31 +07:00
parent 47c433e7c1
commit c6458c6ec1
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
2 changed files with 11 additions and 5 deletions

View File

@ -53,7 +53,12 @@ class SearchProcess:
if index == "ta_subtitle":
processed = self._process_subtitle(result)
processed.update({"_index": index})
processed.update(
{
"_index": index,
"_score": round(result.get("_score", 0), 2),
}
)
return processed

View File

@ -1147,12 +1147,13 @@ function createFulltext(fullText) {
</div>
</a>
<div class="video-desc list">
<div>
<a href="/channel/${fullText.subtitle_channel_id}/"><h3>${fullText.subtitle_channel}</h3></a>
<a class="video-more" href="/video/${videoId}/?t=${subtitle_start}"><h2>${fullText.title}</h2></a>
</div>
<p>${subtitle_start} - ${subtitle_end}</p>
<p>${fullText.subtitle_line}</p>
<div>
<a href="/channel/${fullText.subtitle_channel_id}/"><h3>${fullText.subtitle_channel}</h3></a>
<a class="video-more" href="/video/${videoId}/?t=${subtitle_start}"><h2>${fullText.title}</h2></a>
</div>
<span class="settings-current">Score: ${fullText._score}</span>
</div>
`;
const fullTextDiv = document.createElement('div');