Nick’s demo
The latest version of MJT supports auto-complete. See Nick’s simple example.
Will’s demo
Here’s my example (currently specific to films) Notice how the thumbnail updates as you navigate the menu
I had to add an extra ‘onchange’ hook, see source code for details.
July 10, 2007 at 1:33 am |
Hi Will,
I think Nick’s example is using mql to do prefix matching. We also have an autocomplete service that’s not really documented. If you try autocompleting on freebase.com, you should be able to see the call to that service using firebug. Anyway, I’ve implemented a mjt.Task to do this:
// mjt.Task for /api/service/autocomplete
fb.AutocompleteTask = function(prefix, type, category) {
mjt.Task.apply(this);
if (!type) type = “/common/topic”;
if (!category) category = “instance”;
this.values = {prefix: prefix, type: type, category: category,
disamb: 1, limit: 10, get_all_types: 0} // defaults
};
fb.AutocompleteTask.prototype.enqueue = function() {
var req = this; // for closure
var path = “/api/service/autocomplete”;
mjt.callback_script_get(mjt.service_url, path, this.values,
function (o) {
mjt.parse_metaweb_script_response(req, o);
});
};
July 10, 2007 at 11:17 pm |
Hi Dae, thanks for the code snippet. I’ll try and make some time to make another example using your mjt.Task It will be interesting to compare the performance.