mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-02 17:45:46 +01:00
Fix result logic
This commit is contained in:
parent
9cef8ec087
commit
5ce4d5f552
@ -171,7 +171,14 @@ impl<'a> Recommend<'a> {
|
|||||||
let mut document_scores = Vec::with_capacity(self.limit);
|
let mut document_scores = Vec::with_capacity(self.limit);
|
||||||
|
|
||||||
// skip offset +1 to skip the target document that is normally returned
|
// skip offset +1 to skip the target document that is normally returned
|
||||||
for (docid, distance) in results.into_iter().skip(self.offset + 1) {
|
for (docid, distance) in results.into_iter().skip(self.offset) {
|
||||||
|
if documents_ids.len() == self.limit {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if id == docid {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
documents_ids.push(docid);
|
documents_ids.push(docid);
|
||||||
|
|
||||||
let score = 1.0 - distance;
|
let score = 1.0 - distance;
|
||||||
|
Loading…
Reference in New Issue
Block a user