[Developers] freebase-suggest modification
Christopher Dummy
christopher.dummy at gmail.com
Fri May 16 14:42:03 UTC 2008
This seems to be the same issue I was talking about with the API
Search service. It is return results even if they are not matching. It
was working until last week correctly.
On Fri, May 16, 2008 at 4:39 AM, Zodiac Seven <zodiac.seven at gmail.com> wrote:
> Another thing, I notice that if use this url:
>
> http://www.freebase.com/api/service/search?callback=jsonp1210929592444&type=%2Fcommon%2Ftopic&start=0&limit=3&prefix=iuytui
>
> The 'iuytui' is junk and if I try it at freebase.com's auto complete search
> I get no matches, yet the above search (used by freebase suggest) returns:
>
> jsonp1210929592444({
> "status": "200 OK",
> "query": {
> "start": 0,
> "prefix": "iuytui",
> "limit": 3,
> "escape": "html",
> "query": "",
> "type": "/common/topic"
> },
> "code": "/api/status/ok",
> "result": [
> {
> "name": "Race",
> "image": {
> "id": "/guid/9202a8c04000641f80000000049908cd"
> },
> "alias": [],
> "article": {
> "id": "/guid/9202a8c04000641f80000000001a8085"
> },
> "guid": "#9202a8c04000641f80000000001a807f",
> "type": [
> {
> "id": "/common/topic",
> "name": "Topic"
> }
> ],
> "id": "/guid/9202a8c04000641f80000000001a807f"
> },
> {
> "name": "Federal Information Processing Standard",
> "image": null,
> "alias": [],
> "article": {
> "id": "/guid/9202a8c04000641f8000000000017bae"
> },
> "guid": "#9202a8c04000641f8000000000017ba6",
> "type": [
> {
> "id": "/common/topic",
> "name": "Topic"
> }
> ],
> "id": "/en/federal_information_processing_standard"
> },
> {
> ...
>
> Any idea how I can fix it to return relevant suggestions like on your site
>
> On 5/16/08, Dae Park <daepark at metaweb.com> wrote:
>>
>> freebase-suggest uses the search API (http://www.freebase.com/view/
>> guid/9202a8c04000641f8000000006ad84c9).The search API only returns
>> topic, type, image and article ids (e.g. http://www.freebase.com/api/
>> service/search?query=w&type=/people/person). It does not return any
>> wikipedia keys in which you can filter on.
>>
>> The freebase-suggest library (freebase-controls.js) also contains a
>> "select" control (like the html select tag) that does do a MQL query
>> to get all instances of a particular type. Take a look at
>> SelectControl (in freebase-controls.js) on how you can pass an
>> arbitrary MQL query and modify freebase-suggest to invoke the mqlread
>> service instead of the search service.
>>
>>
>> -dae
>>
>>
>>
>>
>> On May 15, 2008, at 12:41 PM, Faye Li wrote:
>>
>> > Freebase suggest has a filter option (see fbs.filter) for filtering
>> > items out of the result list. That sounds like the most promising
>> > place
>> > to start digging. I'm hoping someone who has worked directly with that
>> > area can chime in.
>> >
>> > -- Faye
>> >
>> >
>> > Zodiac Seven wrote:
>> >> Yes, that sounds like what I need, where should i start modifying
>> >> freebase suggest to do this?
>> >>
>> >> On 5/16/08, *Faye Li* <faye at metaweb.com <mailto:faye at metaweb.com>>
>> >> wrote:
>> >>
>> >> Since many articles are entered/edited by the Freebase community
>> >> and not
>> >> imported from Wikipedia, Wikipedia keys are a better indicator
>> >> for
>> >> identifying those that are. Sounds like the query you want is
>> >> asking for
>> >> only things that have wiki keys.
>> >>
>> >> -- Faye
>> >>
>> >>
>> >> Zodiac Seven wrote:
>> >>> Thanks,
>> >>>
>> >>> Would there be a way to tweak freebase suggest to only show topics
>> >>> which exist in wikipedia - I guess I have to not get results which
>> >>> have article:null? I can't find the MQL query which it uses
>> >> anywhere...
>> >>>
>> >>> On 5/15/08, *Brian Karlak* <zenkat at metaweb.com
>> >> <mailto:zenkat at metaweb.com>
>> >>
>> >>> <mailto:zenkat at metaweb.com <mailto:zenkat at metaweb.com>>> wrote:
>> >>>
>> >>>
>> >>> The wikipedia title and ID are stored as the /wikipedia/en and
>> >>> /wikipedia/en_id keys on the topic, and can be retrieved by the
>> >>> following MQL:
>> >>>
>> >>> {
>> >>> "a:key" : [
>> >>> {
>> >>> "namespace" : "/wikipedia/en",
>> >>> "value" : null
>> >>> }
>> >>> ],
>> >>> "b:key" : {
>> >>> "namespace" : "/wikipedia/en_id",
>> >>> "value" : null
>> >>> },
>> >>> "guid" : "#9202a8c04000641f800000000009216a"
>> >>> }
>> >>>
>> >>> Currently, all valid titles and redirects for an article are
>> >>> stored in /wikipedia/en. The /wikipedia/en_id key, however,
>> >>> should point to the most recent wikipedia ID for the topic. You
>> >>> can access the wikipedia page with this ID using the
>> >> following URL:
>> >>>
>> >>> http://en.wikipedia.org/wiki/index.html?curid=82976
>> >>>
>> >>> Brian
>> >>>
>> >>> On May 15, 2008, at 4:11 AM, Zodiac Seven wrote:
>> >>>
>> >>>> Okay, i guess i will make the results var global and access it
>> >>>> from the callback.
>> >>>>
>> >>>> Is there a freebase api to get the name of the article in
>> >> wikipedia?
>> >>>> so if I have the id as "/en/taj_mahal" and the guid as
>> >>>> "#9202a8c04000641f800000000009216a", name as "Taj Mahal"
>> >>>> I guess there must be a way to find out the wikipedia article
>> >>>> name which is http://en.wikipedia.org/wiki/Taj_mahal
>> >>>>
>> >>>> On 5/15/08, *Dae Park* <daepark at metaweb.com
>> >> <mailto:daepark at metaweb.com>
>> >>
>> >>>> <mailto:daepark at metaweb.com <mailto:daepark at metaweb.com>>>
>> >> wrote:
>> >>>>
>> >>>> I am unaware of any methods invoking something cross domain
>> >>>> synchronously. Even if it's possible, I doubt you want the
>> >>>> browser to
>> >>>> be "blocked" while you are waiting for your response.
>> >>>>
>> >>>>
>> >>>> -dae
>> >>>>
>> >>>>
>> >>>>
>> >>>> On May 14, 2008, at 8:25 AM, Zodiac Seven wrote:
>> >>>>
>> >>>>> Dae,
>> >>>>>
>> >>>>> $.ajax is using a async callback too. Isn't there an
>> >>>> approach which
>> >>>>> will
>> >>>>> work synchronously like XmlHttpRequest?
>> >>>>>
>> >>>>> On 5/14/08, Dae Park <daepark at metaweb.com
>> >> <mailto:daepark at metaweb.com>
>> >>
>> >>>> <mailto:daepark at metaweb.com
>> >> <mailto:daepark at metaweb.com>>> wrote:
>> >>>>>>
>> >>>>>> You should be able to $.ajax with "jsonp" as the
>> >> dataType to
>> >>>>>> accomplish what you want.
>> >>>>>>
>> >>>>>> -dae
>> >>>>>>
>> >>>>>>
>> >>>>>>
>> >>>>>> On May 13, 2008, at 11:09 AM, Zodiac Seven wrote:
>> >>>>>>
>> >>>>>>> This is more of a javascript question then a
>> >> freebase one but
>> >>>>>>> hoping someone here can help.
>> >>>>>>>
>> >>>>>>> I am trying to make a call to a webservice in
>> >> freebase suggest
>> >>>>>>> (http://code.google.com/p/freebase-suggest/)
>> >>>>>>> This means I call a web service for every
>> >> suggestion and
>> >>>> depending
>> >>>>>>> on that i display the suggestion.
>> >>>>>>>
>> >>>>>>> freebase.suggest.js Line 528.
>> >>>>>>>
>> >>>>>>> p.list_receive = function(input, txt, o)
>> >>>> {//fb.log("list_receive",
>> >>>>>>> input, query, o);
>> >>>>>>> // handle errors
>> >>>>>>> if (o.status !== '200 OK') {
>> >>>>>>> fb.error("list_receive", o.code, o.messages, o);
>> >>>>>>> return;
>> >>>>>>> }
>> >>>>>>> ...
>> >>>>>>> var url = 'http://somesite/webservice?
>> >>>>>>> callback=mycheckfunction&term=' + suggestKeyWord;
>> >>>>>>>
>> >>>>>>> // Create a script tag, set its src attribute and
>> >> add it
>> >>>> to the
>> >>>>>>> document
>> >>>>>>> // This triggers the HTTP request and submits the query
>> >>>>>>> var script = document.createElement("script");
>> >>>>>>> script.src = url;
>> >>>>>>> document.body.appendChild(script);
>> >>>>>>> ...
>> >>>>>>> // further logic to add/remove the item
>> >>>>>>>
>> >>>>>>> My problem is that i'm using
>> >>>> document.createElement("script" and
>> >>>>>>> since that is async i have no idea of knowing the
>> >> response
>> >>>> of my
>> >>>>>>> web service.
>> >>>>>>> I could move the further logic into the callback but is
>> >>>> there a
>> >>>>>>> 'synchronous' way to wait until i get a response
>> >> from my web
>> >>>>>>> service.
>> >>>>>>> I can't use xmlHttpRequest because of the cross domain
>> >>>> restriction.
>> >>>>>>>
>> >>>>>>
>> >>>>>>> _______________________________________________
>> >>>>>>> Developers mailing list
>> >>
>> >>>>>>> Developers at freebase.com
>> >> <mailto:Developers at freebase.com> <mailto:Developers at freebase.com
>> >> <mailto:Developers at freebase.com>>
>> >>
>> >>>>>>> http://lists.freebase.com/mailman/listinfo/developers
>> >>>>>>
>> >>>>>> _______________________________________________
>> >>>>>> Developers mailing list
>> >>
>> >>>>>> Developers at freebase.com
>> >> <mailto:Developers at freebase.com> <mailto:Developers at freebase.com
>> >> <mailto:Developers at freebase.com>>
>> >>
>> >>>>>> http://lists.freebase.com/mailman/listinfo/developers
>> >>>>>>
>> >>>>> _______________________________________________
>> >>>>> Developers mailing list
>> >>
>> >>>>> Developers at freebase.com
>> >> <mailto:Developers at freebase.com> <mailto:Developers at freebase.com
>> >> <mailto:Developers at freebase.com>>
>> >>
>> >>>>> http://lists.freebase.com/mailman/listinfo/developers
>> >>>>
>> >>>> _______________________________________________
>> >>>> Developers mailing list
>> >>
>> >>>> Developers at freebase.com
>> >> <mailto:Developers at freebase.com> <mailto:Developers at freebase.com
>> >> <mailto:Developers at freebase.com>>
>> >>
>> >>>> http://lists.freebase.com/mailman/listinfo/developers
>> >>>>
>> >>>>
>> >>>> _______________________________________________
>> >>>> Developers mailing list
>> >>
>> >>>> Developers at freebase.com <mailto:Developers at freebase.com>
>> >> <mailto:Developers at freebase.com <mailto:Developers at freebase.com>>
>> >>
>> >>>> http://lists.freebase.com/mailman/listinfo/developers
>> >>>
>> >>>
>> >>> _______________________________________________
>> >>> Developers mailing list
>> >>
>> >>> Developers at freebase.com <mailto:Developers at freebase.com>
>> >> <mailto:Developers at freebase.com <mailto:Developers at freebase.com>>
>> >>
>> >>> http://lists.freebase.com/mailman/listinfo/developers
>> >>>
>> >>>
>> >>>
>> >>
>> >> ---------------------------------------------------------------------
>> >> ---
>> >>>
>> >>> _______________________________________________
>> >>> Developers mailing list
>> >>> Developers at freebase.com <mailto:Developers at freebase.com>
>> >>> http://lists.freebase.com/mailman/listinfo/developers
>> >>>
>> >>
>> >> _______________________________________________
>> >> Developers mailing list
>> >> Developers at freebase.com <mailto:Developers at freebase.com>
>> >> http://lists.freebase.com/mailman/listinfo/developers
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> ---
>> >>
>> >> _______________________________________________
>> >> Developers mailing list
>> >> Developers at freebase.com
>> >> http://lists.freebase.com/mailman/listinfo/developers
>> >>
>> >
>> > _______________________________________________
>> > Developers mailing list
>> > Developers at freebase.com
>> > http://lists.freebase.com/mailman/listinfo/developers
>>
>> _______________________________________________
>> Developers mailing list
>> Developers at freebase.com
>> http://lists.freebase.com/mailman/listinfo/developers
>
>
> _______________________________________________
> Developers mailing list
> Developers at freebase.com
> http://lists.freebase.com/mailman/listinfo/developers
>
>
--
Christopher Cotton
Zing/Dell Engineer
http://zing.net/
More information about the Developers
mailing list