mirror of
https://github.com/codex-team/codex.docs.git
synced 2025-07-19 13:19:42 +02:00
update
This commit is contained in:
parent
6db7fc876c
commit
e15a5e8a85
2 changed files with 6 additions and 8 deletions
|
@ -61,11 +61,7 @@ class Search {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
const searchWords = searchString
|
const searchWords = this.splitTextToWords(searchString);
|
||||||
.trim()
|
|
||||||
.toLowerCase()
|
|
||||||
.replace(/\s+/g, ' ')
|
|
||||||
.split(' ');
|
|
||||||
|
|
||||||
const goodPages = (await this.getPagesByWords(searchWords))
|
const goodPages = (await this.getPagesByWords(searchWords))
|
||||||
.slice(0, 10);
|
.slice(0, 10);
|
||||||
|
@ -182,9 +178,9 @@ class Search {
|
||||||
private getBlockRatio(block: any) {
|
private getBlockRatio(block: any) {
|
||||||
switch (block.type) {
|
switch (block.type) {
|
||||||
case 'header':
|
case 'header':
|
||||||
return 6;
|
return 8;
|
||||||
case 'paragraph':
|
case 'paragraph':
|
||||||
return 2;
|
return 1.1;
|
||||||
case 'list':
|
case 'list':
|
||||||
return 1;
|
return 1;
|
||||||
default:
|
default:
|
||||||
|
@ -240,6 +236,8 @@ class Search {
|
||||||
// remove multiple spaces
|
// remove multiple spaces
|
||||||
.replace(/\s+/g, ' ')
|
.replace(/\s+/g, ' ')
|
||||||
|
|
||||||
|
.trim()
|
||||||
|
|
||||||
// split to words by spaces
|
// split to words by spaces
|
||||||
.split(' ')
|
.split(' ')
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ export default class Search {
|
||||||
* - type a search string
|
* - type a search string
|
||||||
* - fire search
|
* - fire search
|
||||||
*/
|
*/
|
||||||
// const testString = 'api method';
|
// const testString = 'access editor';
|
||||||
// this.toggleSearchOverlay(true);
|
// this.toggleSearchOverlay(true);
|
||||||
// this.nodes.searchInput.value = testString;
|
// this.nodes.searchInput.value = testString;
|
||||||
// this.debouncedSearch(testString);
|
// this.debouncedSearch(testString);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue