Skip to content

Commit

Permalink
wip: fuzzy search
Browse files Browse the repository at this point in the history
  • Loading branch information
nikku committed Dec 26, 2024
1 parent 2e2bafe commit 8a096d9
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 4 deletions.
10 changes: 10 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 15 additions & 3 deletions packages/app/lib/apps/search/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { parseSearch, parseTemporalFilter } from '../../util/index.js';
import { issueIdent } from '../../util/index.js';
import { LinkTypes } from '../../links.js';

import Fuse from 'fuse.js';

const CHILD_LINK_TYPES = {
[ LinkTypes.CHILD_OF ]: true,
[ LinkTypes.CLOSES ]: true
Expand All @@ -26,6 +28,16 @@ export default function Search(config, logger, store) {
name: 'wuffle:search'
});

let cursor = store.getUpdateCursor();

Check failure on line 31 in packages/app/lib/apps/search/Search.js

View workflow job for this annotation

GitHub Actions / Build

'cursor' is assigned a value but never used. Allowed unused vars must match /^_/u

const index = Fuse.createIndex([], []);

index.create();

store.on('updated', () => {

});

function filterNoop(issue) {
return true;
}
Expand Down Expand Up @@ -334,12 +346,12 @@ export default function Search(config, logger, store) {
}

/**
* Retrieve a filter function from the given search string.
* Retrieve a issues that match a certain search criteria.
*
* @param {string} search
* @param {import('../../types.js').GitHubUser} [user]
*
* @return {Function}
* @return {Issue[]}
*/
function getSearchFilter(search, user) {

Check failure on line 356 in packages/app/lib/apps/search/Search.js

View workflow job for this annotation

GitHub Actions / Build

'getSearchFilter' is defined but never used. Allowed unused vars must match /^_/u

Expand All @@ -366,5 +378,5 @@ export default function Search(config, logger, store) {

// api ///////////////////////

this.getSearchFilter = getSearchFilter;
this.search = search;

Check failure on line 381 in packages/app/lib/apps/search/Search.js

View workflow job for this annotation

GitHub Actions / Build

'search' is not defined
}
4 changes: 3 additions & 1 deletion packages/app/lib/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,10 @@ export default class Store {
}

// ensure board is re-computed on next request

this.boardCache = null;

// allow others to hook into updates
await this.emit('updated');
}, 250);

}
Expand Down
1 change: 1 addition & 0 deletions packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"compression": "^1.7.5",
"express-session": "^1.18.1",
"fake-tag": "^5.0.0",
"fuse.js": "^7.0.0",
"memorystore": "^1.6.7",
"min-dash": "^4.1.1",
"mkdirp": "^3.0.1",
Expand Down

0 comments on commit 8a096d9

Please sign in to comment.