Skip to content
This repository has been archived by the owner on Nov 17, 2022. It is now read-only.

Tokenize search results and highlight the matches in the sidebar #306

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thomcc
Copy link
Contributor

@thomcc thomcc commented Feb 11, 2018

By tokenize I just mean allow searching "foo bar" to match "foo baz bar" and such, each word (split on \s+) is checked separately.

The more complex part of this is highlighting them, or really figuring out which parts to highlight. The end result behaves pretty well.

if (tokens.length === 0) {
return true;
}
let title = normalizeStr(this.title);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about combining this.title and this.url in a single string?

@eoger
Copy link
Owner

eoger commented Mar 2, 2018

From IRC: Can you also put findHighlightedRanges and _highlightSearchResults in a separate file? You could provide a callback to create the nodes.

@eoger
Copy link
Owner

eoger commented Mar 17, 2018

Also interesting possibility is we want fuzzy search: https://github.com/farzher/fuzzysort

@thomcc
Copy link
Contributor Author

thomcc commented Mar 19, 2018

Fuzzy search would be better without a doubt. It seemed to me like this was a necessary first step though, but I hadn't considered just using a library for it.

eoger added a commit that referenced this pull request May 5, 2018
This takes a different route than #306 by using the fuzzysort library.
The filtered tabs are ordered by relevance.
In consequence, the drag-and-drop experience during a search might feel
inconsistent to the user since the search order != tabs order.
@ariasuni
Copy link
Contributor

Should this be closed, since fuzzy searching has been implemented?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants