Sachini / freebase-suggest

Automatically exported from code.google.com/p/freebase-suggest
Other
0 stars 0 forks source link

Would be nice to be able to filter the data before it is sent to the API #11

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi, there doesn't seem to be an easy way to intercept the form input before
it is sent to the public API. It would be great if I could, for example,
return false from the "fb-textchange" event handler in order to prevent the
autocompletion event from occurring. For example, if the form input is a
URL or URN I probably don't want to submit it to FreeBase since I'm
virtually guaranteed an empty result set.

I'd prefer not to "destroy" the instance since that would also require
unbinding multiple event handlers, and then recreating the instance and
rebinding them when the field changes again.

Thanks

Original issue reported on code.google.com by klo...@gmail.com on 18 Mar 2010 at 11:20

GoogleCodeExporter commented 9 years ago
That sounds useful, but note there is at least one case where URLs are 
valid/useful 
input - when they represent Freebase topics.  Then it's basically an alternate 
form of 
the ID which is easier to cut & paste in some circumstances.

Original comment by tfmorris on 18 Mar 2010 at 5:00

GoogleCodeExporter commented 9 years ago
tfmorris is right, freebase suggest service recognizes freebase topic URLs and 
it's possible it will support other 
URLs as well. If I am understanding you correctly, you basically want a hook 
for you to examine the input value 
before letting suggest submit the query?  Or if you want free form text and NOT 
require the user to select 
something from the suggest list, there is an option you can pass to suggest 
{"soft": true}. This allows the input to 
behave normally within a form field. For example in a search box, with 
soft=true, you can intercept the select 
event or have the user submit the free form text to your own search service.

Original comment by daep...@gmail.com on 18 Mar 2010 at 6:48