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

Should Bloodhound index remote datums? #1148

Open
charlotte-miller opened this issue Mar 26, 2015 · 4 comments
Open

Should Bloodhound index remote datums? #1148

charlotte-miller opened this issue Mar 26, 2015 · 4 comments
Milestone

Comments

@charlotte-miller
Copy link
Contributor

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?

@sigpwned
Copy link

sigpwned commented 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
Copy link

dloomer commented 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
Copy link
Contributor Author

@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.

@jharding
Copy link
Contributor

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.

jharding pushed a commit to jharding/typeahead.js that referenced this issue Apr 27, 2015
@jharding jharding added this to the 0.11.2 milestone Apr 27, 2015
ekoyle added a commit to ekoyle/librenms that referenced this issue Jan 6, 2016
3d2a7eb Merge pull request librenms#28 from sheeley/feature/select-on-hover
2d5d521 Set cursor on hover.
d60aed0 Merge pull request librenms#27 from sheeley/feature/complete-current-selection
5e351d1 Merge pull request librenms#41 from Pheil/patch-1
53400c3 Fixed 404 links
5c49ed8 Complete to currently selected suggestion.
6da45f5 Merge pull request librenms#37 from jorrit/patch-1
eab11e6 Fix typos in comments in plugin.js
3d929c8 Add stuff that has been changed or added by now
79a991b Reformat changelog
b46224c Merge pull request librenms#25 from jesperronn/node_version
f241826 update travis to run latest supported node version
5d69578 Merge pull request librenms#19 from jesperronn/npm_package_updates
d78ad00 lock jasmine-query to old version 1.7.0, which has guaranteed support for jquery 1.
0cb71e9 updating npm packages dependencies
e7dfc42 Change capitalization
14dfe96 Update to new domain name
9c2b65c Merge pull request librenms#22 from jesperronn/cache_node_modules
9e40c85 General overhaul of the readme
c665a6b Add some badges
b111a6f Remove jQuery package manager has been deprecated
b802342 Update NPM and Bower
6c12035 attempt to speed up Travis builds with cache directive
e5c0213 Merge pull request librenms#18 from jesperronn/license_for_npm_package
8d448ea Fixed npm error: adding License link
e0556c5 Merge pull request librenms#16 from jesperronn/node_static_dependency
c1c6ef9 Merge pull request librenms#15 from jesperronn/npm_postinstall
76dbb90 Travis must have bower installed before running "npm install"
b170811 node-static webserver installed locally is good enough.
eee05f0 added a postinstall step to npm to cater for easy setup
1f0684f Merge pull request librenms#14 from jcrben/patch-1
e232400 bloodhound.get->bloodhound.search
c69b990 Merge pull request librenms#10 from thiagof/dist-build
a080d81 distribution build
8e1ffc4 Merge pull request librenms#8 from coopy/fix-async-render-corejs
a52bd45 Update rendered-count _after_ async results have displayed
6f191d2 Merge pull request librenms#5 from corejavascript/integration-0.11.2
5e62960 Merge pull request librenms#2 from chip-miller/integration-0.11.2
fad5bd1 Merge pull request librenms#4 from corejavascript/integration-0.11.2
9722aeb Adding Option: matchAnyQueryToken (default false) - By default a search result must match ALL query-tokens. Instead, this option returns results that match ANY
a36e6a0 gh-pages are now hosted on the .io domain
6e33c92 Merge pull request librenms#1 from corejavascript/update-name
86ddae4 Update name and links
312d481 Merge pull request librenms#1200 from jharding/1185-bad-async-logic
e2d9608 Merge pull request librenms#1199 from jharding/1163-val-undefined
173b4b5 Fix bad async suggestions rendering logic
c58519e Coerce val to string when set through API
b2b588d Merge pull request librenms#1192 from jharding/1102-scroll-top-open
04f1d66 Scroll menu to top on open
4fe2a34 Merge remote-tracking branch 'origin/1148-index-remote' into integration-0.11.2
212fe89 Register as an anonymous AMD module
f885f48 Make indexing remote a top-level option
5b70c60 Bloodhound optionally indexes/matches remote data - twitter/typeahead.js#1148

git-subtree-dir: lib/typeahead
git-subtree-split: 3d2a7eb548ef2b737f875e8da634466bd62edd5e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants