spencermountain / Freebase.js

inference and inspection on freebase data
107 stars 14 forks source link

Understanding search API matching logic in autocomplete use cases #9

Closed metalaureate closed 9 years ago

metalaureate commented 9 years ago

Thanks for this module - very useful. I need to understand why the search API behaves a certain way. I'm using .search with no type key, to provide auto-complete functionality.

   freebase.search(term, {  key: nconf.get('google_api_key')}, function (result) { });

"social ident" matches nothing "social identity" matches a bunch of things

In the autocomplete scenario, I need social ident to also match social identity. This is how the search box works on freebase.org.

Could you give me some pointers on why it behaves this way, and how to make it behave the way I want?

Yours gratefully.

spencermountain commented 9 years ago

hi simon, thanks! this'll work

var freebase=require("freebase")
freebase.search("social ident", {key:"mykey", prefixed:true}, function(r){
  console.log(JSON.stringify(r, null, 2));
})

https://developers.google.com/freebase/v1/search maybe this should be a defined method cheers

metalaureate commented 9 years ago

Perfect, thank you.