mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-15 05:37:32 +00:00
feat(core): tuning for better search (#7713)
This commit is contained in:
@@ -6,4 +6,5 @@ test('bm25', () => {
|
|||||||
expect(bm25(1, 1, 10, 10, 15)).toEqual(3.2792079793859643);
|
expect(bm25(1, 1, 10, 10, 15)).toEqual(3.2792079793859643);
|
||||||
expect(bm25(2, 1, 10, 10, 15) > bm25(1, 1, 10, 10, 15)).toBeTruthy();
|
expect(bm25(2, 1, 10, 10, 15) > bm25(1, 1, 10, 10, 15)).toBeTruthy();
|
||||||
expect(bm25(1, 1, 10, 10, 15) > bm25(2, 1, 10, 100, 15)).toBeTruthy();
|
expect(bm25(1, 1, 10, 10, 15) > bm25(2, 1, 10, 100, 15)).toBeTruthy();
|
||||||
|
expect(bm25(1, 1, 10, 10, 15) > bm25(1, 1, 10, 100, 15)).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -57,6 +57,6 @@ export const bm25 = (
|
|||||||
invDocFreq *
|
invDocFreq *
|
||||||
(d +
|
(d +
|
||||||
(termFreq * (k + 1)) /
|
(termFreq * (k + 1)) /
|
||||||
(termFreq + k * (1 - b + (b * fieldLength) / avgFieldLength)))
|
(termFreq + k * (1 - b + b * (fieldLength / avgFieldLength))))
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ export class DocsSearchService extends Service {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'boost',
|
type: 'boost',
|
||||||
boost: 100,
|
boost: 1.5,
|
||||||
query: {
|
query: {
|
||||||
type: 'match',
|
type: 'match',
|
||||||
field: 'flavour',
|
field: 'flavour',
|
||||||
|
|||||||
Reference in New Issue
Block a user