[freebase-suggest commit] r100 - trunk/examples

2 views
Skip to first unread message

codesite...@google.com

unread,
Jun 19, 2008, 12:49:49 PM6/19/08
to freebase...@googlegroups.com
Author: will.moffat
Date: Thu Jun 19 09:49:12 2008
New Revision: 100

Modified:
trunk/examples/suggest_demo2.html
trunk/examples/suggest_demo_with_minitopic.html

Log:
Fixed: strict=1 was breaking Freebase Suggest - removed since default
strict=false usually gives good results (see http://www.freebase.com/view/guid/9202a8c04000641f8000000006ad84c9)
Fixed: multiple type example (search API had changed, no longer allows
comma lists)
Changed: simplified examples (cleaner jQuery + no longer passing
unnecessary args to search api)

Thanks to Martin Dudek for spotting the problems.


Modified: trunk/examples/suggest_demo2.html
==============================================================================
--- trunk/examples/suggest_demo2.html (original)
+++ trunk/examples/suggest_demo2.html Thu Jun 19 09:49:12 2008
@@ -31,7 +31,7 @@
<h3>Films</h3>
Last film I saw: <input type="text" id="example3" />

-<h3>Film critic who is also an actor - mutiple type constraint</h3>
+<h3>Film critic who is also an actor - multiple type constraint</h3>
Film critic + actor: <input type="text" id="actor_cr" />

<h3>People - with callback</h3>
@@ -40,22 +40,15 @@
<div id="log" style="margin:1em;"></div>

<script type="text/javascript">
-jQuery(document).ready( function($) {
- var settings = {
- '#example1' : {},
- '#example2' : { type:'/music/album' },
- '#example3' : { type:'/film/film' },
- '#actor_cr' : { type:'/film/actor,/film/film_critic' },
- '#example4' : { type:'/people/person' }
- };
-
- for (var id in settings) {
- var ac_param = { type: '/common/topic', category: "instance",
get_all_types: "0", disamb: "1", limit: "10", strict:1 };
- $.extend( ac_param, settings[id] );
- $(id).freebaseSuggest( {ac_param:ac_param} );
- }
+jQuery( function($) {

- $("#example4")
+ $('#example1').freebaseSuggest();
+ $('#example2').freebaseSuggest( {ac_param:{type:'/music/album'}} );
+ $('#example3').freebaseSuggest( {ac_param:{type:'/film/film'}} );
+ $('#actor_cr').freebaseSuggest( {ac_param:{type:'/film/actor',
type:'/film/film_critic'}} );
+
+ $('#example4')
+ .freebaseSuggest( {ac_param:{type:'/people/person'}} )
.bind("fb-select", function(e, data) { $('#log').text("suggest: "+
data.id+" -- "+ data.name); });

});

Modified: trunk/examples/suggest_demo_with_minitopic.html
==============================================================================
--- trunk/examples/suggest_demo_with_minitopic.html (original)
+++ trunk/examples/suggest_demo_with_minitopic.html Thu Jun 19 09:49:12 2008
@@ -31,9 +31,9 @@

<script type="text/javascript">
jQuery(function($) {
- var ac_param = { type: '/people/person', category: "instance",
get_all_types: "0", disamb: "1", limit: "10", strict:1 };
+
$("#example1")
- .freebaseSuggest( {ac_param:ac_param} )
+ .freebaseSuggest( {ac_param:{type:'/people/person'}} )
.bind("fb-select", function(e, data) {
$('#miniTopic').show().freebaseMiniTopic(data.id);
});

Reply all
Reply to author
Forward
0 new messages