Skip to content

Commit

Permalink
Merge pull request #1119 from VamshiReddy02/hub-search
Browse files Browse the repository at this point in the history
Trying to fix the overall performance of the hub search
  • Loading branch information
karthik2804 authored Jan 5, 2024
2 parents 5e0873e + aff40aa commit bfa7990
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions spin-up-hub/src/components/ContentListing.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ export default {
if (this.searchTerm) {
let updatedQuery = this.searchTerm
.split(" ")
.map(word => word + '^2 ' + word + '* ' + word + '~2')
.map(word => word + '^2 ' + word + '*')
.join(' ');
let result = this.searchIndex.search(updatedQuery)
//get only confident results
let matches = []
result.map(k => {
if (k.score < 0.5) {
if (k.score < 5) {
return
}
matches.push(data.find(docs => k.ref == docs.id))
Expand Down
8 changes: 4 additions & 4 deletions spin-up-hub/src/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,15 @@ const store = createStore({
let data = await fetch(import.meta.env.VITE_API_HOST + "/static/hub-index-data.json")
let documents = await data.json()
context.state.searchIndex = lunr(function () {
this.field('title')
this.field('title', { boost: 100 })
this.field('content')
this.field('language', { boost: 10 })
this.field('author'),
this.field('tags', { boost: 100 })
this.field('keywords', { boost: 100 })
this.field('tags', { boost: 10 })
this.field('keywords', { boost: 10 })
this.field('url')
this.ref('id')

documents.forEach(function (doc) {
this.add(doc)
}, this)
Expand Down

0 comments on commit bfa7990

Please sign in to comment.