mirror of
				https://github.com/Brandon-Rozek/website-theme.git
				synced 2025-11-04 03:21:13 +00:00 
			
		
		
		
	Fix bug #19
This commit is contained in:
		
							parent
							
								
									56a5b3e91c
								
							
						
					
					
						commit
						3082199980
					
				
					 1 changed files with 11 additions and 10 deletions
				
			
		| 
						 | 
					@ -65,15 +65,16 @@ const queryNgramSeparator = (query) => {
 | 
				
			||||||
const initLunr = () => {
 | 
					const initLunr = () => {
 | 
				
			||||||
  $.getJSON('index.json').done((index) => {
 | 
					  $.getJSON('index.json').done((index) => {
 | 
				
			||||||
    pagesIndex = index
 | 
					    pagesIndex = index
 | 
				
			||||||
    lunrIndex = lunr(() => {
 | 
					    lunrIndex = lunr(builder => {
 | 
				
			||||||
      this.tokenizer = bigramTokeniser
 | 
					      console.log(builder)
 | 
				
			||||||
      this.pipeline.reset()
 | 
					      builder.tokenizer = bigramTokeniser
 | 
				
			||||||
      this.ref('ref')
 | 
					      builder.pipeline.reset()
 | 
				
			||||||
      this.field('title', { boost: 10 })
 | 
					      builder.ref('ref')
 | 
				
			||||||
      this.field('body')
 | 
					      builder.field('title', { boost: 10 })
 | 
				
			||||||
      this.metadataWhitelist = ['position']
 | 
					      builder.field('body')
 | 
				
			||||||
 | 
					      builder.metadataWhitelist = ['position']
 | 
				
			||||||
      for (let page of pagesIndex) {
 | 
					      for (let page of pagesIndex) {
 | 
				
			||||||
        this.add(page)
 | 
					        builder.add(page)
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
  }).fail((jqxhr, textStatus, error) => {
 | 
					  }).fail((jqxhr, textStatus, error) => {
 | 
				
			||||||
| 
						 | 
					@ -107,9 +108,9 @@ const initUI = () => {
 | 
				
			||||||
  })
 | 
					  })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Event when chenging query
 | 
					  // Event when chenging query
 | 
				
			||||||
  $('#searchBoxInput').keyup(() => {
 | 
					  $('#searchBoxInput').keyup(event => {
 | 
				
			||||||
    const $searchResults = $('#searchResults')
 | 
					    const $searchResults = $('#searchResults')
 | 
				
			||||||
    const query = $(this).val()
 | 
					    const query = $(event.currentTarget).val()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Icon switching
 | 
					    // Icon switching
 | 
				
			||||||
    if (query.length) {
 | 
					    if (query.length) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue