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

Add hooks for customising the way results are ordered and displayed #7

Open
GoogleCodeExporter opened this issue Jun 21, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

I want to use Freebase Suggest as a topic picker for my own site. As part of 
this, I want to alter 
its behaviour slightly - when showing a list of results, I would like to move 
items that have 
previously been used on my site to the top of the suggestions list and visually 
highlight them 
(with an asterisk).

My ideal way of doing this would be to include a JavaScript array of items that 
have already been 
used on my site (which will normally be somewhere between 1 and 100 items long) 
on the page, 
and then customise Freebase Suggest, intercepting the incoming list of 
suggestions and 
bumping any that match my hard-coded list of IDs up to the top.

To do this, I need customisation hooks that allow me to:

1. Intercept the results returned by freebase before they are rendered by the 
widget
2. Modify the DOM elements used by Freebase Suggest to populate the suggestion 
list, as they 
are being created.

These hooks would be useful for much more than just my example here.

Original issue reported on code.google.com by simon%si...@gtempaccount.com on 15 Aug 2009 at 10:02

@GoogleCodeExporter
Copy link
Author

You should be able to accomplish this using the new freebase suggest which is 
now
hosted on freebaselibs.com. The latest version:
http://freebaselibs.com/static/suggest/0.9.4/index.html

you can do something like:

var base = {
  response: $.suggest.suggest.response
}

$.suggest("mysuggest", {

  response: function(data) {

    // you can modify the data here

    // and call super.response

    base.response.apply(this, [data]);

  }

});





Original comment by daep...@gmail.com on 17 Aug 2009 at 5:14

@GoogleCodeExporter
Copy link
Author

Original comment by daep...@gmail.com on 17 Aug 2009 at 6:28

  • Changed state: Accepted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant