Closed thekid closed 1 year ago
We should remove HTML before searching, the highlighting function produces these kinds of fragments every now and then:
We should remove HTML before searching, the highlighting function produces these kinds of fragments every now and then: [...]
Implemented in thekid/dialog@a589a03. Existing data can be migrated as follows:
use com\mongodb\MongoConnection;
use util\cmd\Console;
$c= new MongoConnection($argv[1]);
$entries= $c->database($argv[2])->collection('entries');
foreach ($entries->find() as $document) {
Console::writeLine('> ', $document['title'], ' ', $document['is']);
$entries->update($document->id(), ['$set' => [
'_searchable' => [
'content' => strip_tags(strtr($document['content'], ['<br>' => "\n", '</p><p>' => "\n"])),
'boost' => isset($document['is']['journey']) ? 2 : 1,
]
]]);
}
Now looks like this: https://dialog.sloppy.zone/search?q=Video
We need to be able to distinguish journeys and content in this case:
Boosting results by date so that newer entries take precedenc over older ones is not as easy as I thought it would be. It will probably require a gauss function score, see https://www.mongodb.com/docs/atlas/atlas-search/scoring/#function and https://www.elastic.co/de/blog/0-90-4-released/
See https://dialog.sloppy.zone/search?q=Yosemite:
Suggestions
Based on titles
Ranking
From highest to lowest:
Additional boost factors:
Facetted search
We could include the year as facette
Keywords & synonyms
meta
tags).Atlas configuration
A search index needs to be created in MongoDB Atlas!
Implementation