Reqlogger exceptions, searchig: search till match percent and search in other subjs

This commit is contained in:
mrfry 2021-01-08 13:44:27 +01:00
parent bf4bdfb249
commit 64f41d6748
5 changed files with 61 additions and 46 deletions

View file

@ -32,7 +32,7 @@ import { QuestionDb, Question, User, DataFile } from '../types/basicTypes'
// if a recievend question doesnt match at least this % to any other question in the db it gets
// added to db
const minMatchToAmmountToAdd = 90
const minMatchAmmountToAdd = 90
const writeAfter = 1 // write after # of adds FIXME: set reasonable save rate
let currWrites = 0
@ -166,6 +166,7 @@ function processIncomingRequestUsingDb(
)
logger.DebugLog(currentQuestion, 'actions', 3)
recievedQuestions.push(currentQuestion)
// This here searches only in relevant subjects, and not all subjects
questionSearchPromises.push(
doALongTask({
type: 'work',
@ -174,6 +175,7 @@ function processIncomingRequestUsingDb(
qdb: qdb.data,
question: currentQuestion,
subjName: recievedData.subj,
searchTillMatchPercent: minMatchAmmountToAdd,
},
})
)
@ -184,7 +186,7 @@ function processIncomingRequestUsingDb(
const allQuestions = [] // all new questions here that do not have result
results.forEach((result, i) => {
const add = result.result.every((res) => {
return res.match < minMatchToAmmountToAdd
return res.match < minMatchAmmountToAdd
})
if (add) {
allQuestions.push(recievedQuestions[i])