jeancroy / FuzzySearch

:mag: Fast autocomplete suggestion engine using approximate string matching
MIT License
194 stars 32 forks source link

bumping up certain entries if contains a special keyword #45

Closed halukkaramete closed 2 months ago

halukkaramete commented 3 months ago

Hi Jean,

I have items like this

Joe on health Joe on music Joe on everything Joe on history Jane on math Jane on music Jane on everything

And I'd like the "joe on everything" to be at the very top among the search results that has to do with Joe on this, and joe on that!

So, the "on everything" piece will weigh in! and the results against a query such as simple as "Joe", the resulting order would be like this

Joe on everything
Joe on health Joe on music Joe on history Jane on math Jane on music Jane on everything

as opposed to the default behaviour of something like this

Joe on health Joe on music Joe on history Joe on everything
Jane on math Jane on music Jane on everything

Where do we tell the engine to favor those items with the word "on everything"?

But at the same thing, we would NOT want to see search results this way neither

Joe on everything Jane on everything. <-- we would not want to Jane to be above Joe's cause the user typed only "Joe" Joe on health Joe on music Joe on history Jane on math Jane on music

It should be Joe on Everything and then Joe on Whatever....

The Jane's "on everything" pieces should not make a difference in the search results... Because the user is interested only in Joe but I just do not want the "on everything" special item to get lost among to many top results such as Joe on X, Joe on Y...

I hope I was clear in this question.