Changeset View
Changeset View
Standalone View
Standalone View
keyserver/src/database/search-utils.js
Show First 20 Lines • Show All 128 Lines • ▼ Show 20 Lines | while (true) { | ||||
if (messages.length < pageSize) { | if (messages.length < pageSize) { | ||||
break; | break; | ||||
} | } | ||||
lastID = messages[messages.length - 1].id; | lastID = messages[messages.length - 1].id; | ||||
} | } | ||||
} | } | ||||
const fulltextOperands = ['+', '<', '>', '~']; | |||||
function processQueryForSearch(query: string): string { | |||||
if (query === '') { | |||||
return ''; | |||||
} | |||||
const stemmedQuery = segmentAndStem(query); | |||||
return stemmedQuery | |||||
.split(' ') | |||||
.filter(word => !fulltextOperands.includes(word)) | |||||
.map(segment => `+${segment}`) | |||||
.join(' '); | |||||
} | |||||
export { | export { | ||||
processMessagesForSearch, | processMessagesForSearch, | ||||
processMessagesInDBForSearch, | processMessagesInDBForSearch, | ||||
segmentAndStem, | segmentAndStem, | ||||
stopwords, | stopwords, | ||||
processQueryForSearch, | |||||
}; | }; |