1
0
Fork 0
mirror of https://github.com/codex-team/codex.docs.git synced 2025-07-19 13:19:42 +02:00
This commit is contained in:
Taly 2022-08-30 18:52:15 +03:00
parent 6db7fc876c
commit e15a5e8a85
2 changed files with 6 additions and 8 deletions

View file

@ -61,11 +61,7 @@ class Search {
throw error;
}
const searchWords = searchString
.trim()
.toLowerCase()
.replace(/\s+/g, ' ')
.split(' ');
const searchWords = this.splitTextToWords(searchString);
const goodPages = (await this.getPagesByWords(searchWords))
.slice(0, 10);
@ -182,9 +178,9 @@ class Search {
private getBlockRatio(block: any) {
switch (block.type) {
case 'header':
return 6;
return 8;
case 'paragraph':
return 2;
return 1.1;
case 'list':
return 1;
default:
@ -240,6 +236,8 @@ class Search {
// remove multiple spaces
.replace(/\s+/g, ' ')
.trim()
// split to words by spaces
.split(' ')

View file

@ -57,7 +57,7 @@ export default class Search {
* - type a search string
* - fire search
*/
// const testString = 'api method';
// const testString = 'access editor';
// this.toggleSearchOverlay(true);
// this.nodes.searchInput.value = testString;
// this.debouncedSearch(testString);