fix(memory): avoid over-fetching when weights config is empty
This commit is contained in:
parent
328cf1db6a
commit
61c0cc0a87
@ -623,7 +623,8 @@ export class QmdMemoryManager implements MemorySearchManager {
|
||||
opts?.maxResults ?? this.qmd.limits.maxResults,
|
||||
);
|
||||
// Fetch more results to allow for client-side re-ranking (weighting)
|
||||
const fetchLimit = this.qmd.weights ? limit * 5 : limit;
|
||||
const hasWeights = this.qmd.weights && Object.keys(this.qmd.weights).length > 0;
|
||||
const fetchLimit = hasWeights ? limit * 5 : limit;
|
||||
|
||||
const collectionNames = this.listManagedCollectionNames();
|
||||
if (collectionNames.length === 0) {
|
||||
@ -721,7 +722,6 @@ export class QmdMemoryManager implements MemorySearchManager {
|
||||
}
|
||||
const results: MemorySearchResult[] = [];
|
||||
const weights = this.qmd.weights || {};
|
||||
const hasWeights = Object.keys(weights).length > 0;
|
||||
|
||||
for (const entry of parsed) {
|
||||
const doc = await this.resolveDocLocation(entry.docid, {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user