Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Score exact matches higher over location #78

Closed
boarnoah opened this issue Feb 10, 2016 · 4 comments
Closed

Score exact matches higher over location #78

boarnoah opened this issue Feb 10, 2016 · 4 comments
Labels

Comments

@boarnoah
Copy link

From what I see bitapScore weights matches higher the closer to the "location" given when creating a search over exact matches.
EX: Query "egg" on a list that contains: "----- leggings" and "--------- -------- eggs" would rank the "leggings" higher than the "eggs" item because the "location: 0". Due to the nature of my items I can't guarantee where the keywords would be in the object names, even as an approximation.

Any thoughts into how I would modify the current bitap scoring to ignore/minimize the effect of location scoring over matches (is this even possible, I might be misunderstanding the whole algorithm).

One other way I can see would be to possibly randomize of keywords in my items/split them at " ", however this would cause bigram matches (ex: "chocolate milk") to rank lower.

@boarnoah
Copy link
Author

I've attached a test case that runs with Node.js and has some example data attached to it. Running queries for it for the terms "egg" should illustrate what I mean.

Granted if you do search "eggs" it puts more relevant results to the top, but it still gives a lower score towards items with "egg" because of location over partial matches.
Hope this helps, thanks.

The data might be a bit weird, but it's from actual production data I'm working with which I have extracted here for demonstration purposes.

FuseExample_78.zip

@krisk
Copy link
Owner

krisk commented Feb 12, 2016

Thanks for test cases, I will take a look!

@krisk krisk added the bug label Feb 12, 2016
@boarnoah
Copy link
Author

Not sure if this is more related to #77 , but if for example you change data to:

[
  {
    "name": "Eggs"
  }
]

For query: "egg"
Fuse 2.0.X will not return the Eggs item, 1.3.1 will however.

Sorry for not being much help other than raising issues, I'm still working on understanding the algorithm.

@einarlove
Copy link

I was experiencing the same issue and reverted back to 1.3.1

@krisk krisk closed this as completed in 9fab30e Feb 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants