[Freebase-discuss] search box on freebase.com and Search Service

5 views
Skip to first unread message

Daniel Weitzenfeld

unread,
Jun 26, 2012, 2:49:30 PM6/26/12
to freebase...@freebase.com
For my application, I may need to build something similar to the
search box at the top of freebase.com, so I'm wondering what's going
on behind the scenes.

Is it calling the Search Service? (http://wiki.freebase.com/wiki/ApiSearch)

It appears to be regex-searching the /type/object/name in /lang/en -
is that right?

E.g., when I type 'Kim Kardashian', the top suggestion is Kim herself,
followed by a list of TV episodes in which her name is part of the
title. Is Kim herself coming up first simply because it's an exact
match? Or is there some other special sauce?

Also, similar to my question yesterday about using the Text Service
via discovery.build in python api, is there a corresponding way to use
the Search Service?

# Text Service (courtesy of Michael Masouras, thanks!)

from apiclient import discovery
from apiclient import model

freebase = discovery.build('freebase', 'v1')

response = freebase.text().get(id="/en/bob_dylan").execute()
print response['result']

# MQLread

query = [{'id': None, 'name': None, 'type': '/astronomy/planet'}]
response = json.loads(freebase.mqlread(query=json.dumps(query)).execute())

# Search Service: ???

Thanks!

Benjamin Good

unread,
Jun 26, 2012, 3:04:54 PM6/26/12
to Freebase.com discussion list
Hi Daniel,

This isn't really answering your question, but if you want that search box you can get it (or something very close to it) using this JQuery plugin:

I used it before in some old projects and its awesome...

You could also look inside it to see how its interacting with freebase.

-Ben


_______________________________________________
You are receiving this message because you are subscribed to the Freebase-discuss mailing list.
To post a message to the list: Freebase...@freebase.com
To unsubscribe, view archives, etc: http://lists.freebase.com/mailman/listinfo/freebase-discuss

Andi Vajda

unread,
Jun 26, 2012, 3:07:21 PM6/26/12
to Freebase.com discussion list

On Tue, 26 Jun 2012, Daniel Weitzenfeld wrote:

> For my application, I may need to build something similar to the
> search box at the top of freebase.com, so I'm wondering what's going
> on behind the scenes.
>
> Is it calling the Search Service? (http://wiki.freebase.com/wiki/ApiSearch)

The search box on freebae.com is calling the old search API.
You should not use the old search API. It is on its way out.
Please, use the new Freebase search API at
https://www.googleapis.com/freebase/v1/search
Yes, http://wiki.freebase.com/wiki/ApiSearch, is about that new API.

> It appears to be regex-searching the /type/object/name in /lang/en -
> is that right?

No, no regular expressions are used. The search service is backed by a full
text search engine, Apache Lucene for the old API, and the corresponding
Google technology for the new API.

> E.g., when I type 'Kim Kardashian', the top suggestion is Kim herself,
> followed by a list of TV episodes in which her name is part of the
> title. Is Kim herself coming up first simply because it's an exact
> match? Or is there some other special sauce?

There is a bunch of special sauce, yes.
For a good description of the special sauce on the _old_ api, please see
http://api.freebase.com/api/service/search?help.

> Also, similar to my question yesterday about using the Text Service
> via discovery.build in python api, is there a corresponding way to use
> the Search Service?

I don't know what 'discovery.build' is or means but the search API, old or
new, is an HTTP API and as such can be used by any library or language that
supports making HTTP calls and processing JSON responses.

Andi..

Michael Masouras

unread,
Jun 26, 2012, 3:45:18 PM6/26/12
to Freebase.com discussion list
Hi Daniel,

Benjamin's link to http://wiki.freebase.com/wiki/Freebase_Suggest is spot on. This is the widget that is used in freebase.com to pick entities and we intend it to be used by developers like you for your project. 

You can also use the search service directly from your own widget. The docs are here:

You should under no circumstances use the old APIs, ignore them completely. 

Michael



On Tue, Jun 26, 2012 at 11:49 AM, Daniel Weitzenfeld <dweitz...@gmail.com> wrote:

Daniel Weitzenfeld

unread,
Jun 26, 2012, 4:06:01 PM6/26/12
to Freebase.com discussion list
Thanks all!
The special sauce is really impressive, with the 'notable' field and
everything.
Reply all
Reply to author
Forward
0 new messages