You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am running into an issue where bloodhound is not behaving as I expected, and I want to know if this is a bug in my code or thinking. My assumption was that remote results get indexed (and filtered) in the same way that local and prefetched data does. My assumption is that remote data is combined with local and prefetched data, then filtered together.
Example:
I search: foo
I get a remote response: [{val:'foo'}, {val:'fooo'},{val:'foooo'},{val:'fooooo'}] //etc.
As I continue to search fooo then foooo I expected bloodhound to filter the no longer matching datums. Maybe it makes more requests for better matching data, but I expected it to filter out foo and fooo (as it does when the data is local or prefetched).
What I am missing? Do I need to manually #add() the data when filtering? I would have expected this to be the default behavior. Is it really the case as suggested in issue #248 that remote data should be exact?
+1. I'm using typeahead and want to confirm that tags being added already exist in the typeahead suggestions from a remote source, and the recommended approach in the docs is to check the index. That works well for local or prefetch data, since that goes into the cache, but less well for remote data, since that doesn't end up in the index.
This sounds something like an issue I just came here to post. Would this prevent additional round-trips to the server in cases where the server had previously provided all the data it can, and the new query is merely the previous one plus another letter?
I'm guessing I'm asking for something a little beyond, since the server would need to somehow indicate that there's nothing left to return for the given query (or optionally, I suppose the client code could just look for a result count below a certain threshold).
@dloomer - that's the idea. My understanding is that Bloodhound will check the server when it has fewer matches then the limit (default 5). So if the server returns 10 results (and Bloodhound indexes the results), and matches 8, then 6, then 4... Bloodhound should ONLY contact the server once it has < 5 matches.
Activity
Bloodhound optionally indexes/matches remote data
sigpwned commentedon Apr 1, 2015
+1. I'm using typeahead and want to confirm that tags being added already exist in the typeahead suggestions from a remote source, and the recommended approach in the docs is to check the index. That works well for local or prefetch data, since that goes into the cache, but less well for remote data, since that doesn't end up in the index.
dloomer commentedon Apr 1, 2015
This sounds something like an issue I just came here to post. Would this prevent additional round-trips to the server in cases where the server had previously provided all the data it can, and the new query is merely the previous one plus another letter?
I'm guessing I'm asking for something a little beyond, since the server would need to somehow indicate that there's nothing left to return for the given query (or optionally, I suppose the client code could just look for a result count below a certain threshold).
charlotte-miller commentedon Apr 1, 2015
@dloomer - that's the idea. My understanding is that Bloodhound will check the server when it has fewer
matchesthen thelimit(default 5). So if the server returns 10 results (and Bloodhound indexes the results), and matches 8, then 6, then 4... Bloodhound should ONLY contact the server once it has < 5 matches.jharding commentedon Apr 25, 2015
To verify assumptions, remote data is not indexed, but it is cached in memory for a bit in case the user hits backspace a few times.
Bloodhound optionally indexes/matches remote data
Squashed 'lib/typeahead/' changes from 588440f..3d2a7eb