Wikidata API wbsearchentities: why are results not the same in Python than in Wikidata?












3















I'm using wbsearchentities (wikidata api) in a python request and I'm wondering why returned results are not the same that those seen on Wikidata. For example, the following command in Python:



url = "https://www.wikidata.org/w/api.php?action=wbsearchentities&search=%s&format=json&limit=50&formatversion=2&language=en" % ('New York Landmarks Preservation Commission')
r = requests.post(url,headers={"User-Agent" : "Magic Browser"})


returns nothing but the same search in the search box of Wikidata returns 2 results (one is the good one: New York City Landmarks Preservation Commission.



Ideally, I would like to have all these results returned from my python request.










share|improve this question























  • What are you expecting to see?

    – Padraic Cunningham
    May 11 '16 at 22:36











  • Same results as those returned when you enter 'New York Landmarks Preservation Commission' in the Wikidata search box, in this case: New York City Landmark (Q19825927) and New York City Landmarks Preservation Commission (Q967276).

    – Patrick
    May 12 '16 at 17:47
















3















I'm using wbsearchentities (wikidata api) in a python request and I'm wondering why returned results are not the same that those seen on Wikidata. For example, the following command in Python:



url = "https://www.wikidata.org/w/api.php?action=wbsearchentities&search=%s&format=json&limit=50&formatversion=2&language=en" % ('New York Landmarks Preservation Commission')
r = requests.post(url,headers={"User-Agent" : "Magic Browser"})


returns nothing but the same search in the search box of Wikidata returns 2 results (one is the good one: New York City Landmarks Preservation Commission.



Ideally, I would like to have all these results returned from my python request.










share|improve this question























  • What are you expecting to see?

    – Padraic Cunningham
    May 11 '16 at 22:36











  • Same results as those returned when you enter 'New York Landmarks Preservation Commission' in the Wikidata search box, in this case: New York City Landmark (Q19825927) and New York City Landmarks Preservation Commission (Q967276).

    – Patrick
    May 12 '16 at 17:47














3












3








3


1






I'm using wbsearchentities (wikidata api) in a python request and I'm wondering why returned results are not the same that those seen on Wikidata. For example, the following command in Python:



url = "https://www.wikidata.org/w/api.php?action=wbsearchentities&search=%s&format=json&limit=50&formatversion=2&language=en" % ('New York Landmarks Preservation Commission')
r = requests.post(url,headers={"User-Agent" : "Magic Browser"})


returns nothing but the same search in the search box of Wikidata returns 2 results (one is the good one: New York City Landmarks Preservation Commission.



Ideally, I would like to have all these results returned from my python request.










share|improve this question














I'm using wbsearchentities (wikidata api) in a python request and I'm wondering why returned results are not the same that those seen on Wikidata. For example, the following command in Python:



url = "https://www.wikidata.org/w/api.php?action=wbsearchentities&search=%s&format=json&limit=50&formatversion=2&language=en" % ('New York Landmarks Preservation Commission')
r = requests.post(url,headers={"User-Agent" : "Magic Browser"})


returns nothing but the same search in the search box of Wikidata returns 2 results (one is the good one: New York City Landmarks Preservation Commission.



Ideally, I would like to have all these results returned from my python request.







python python-requests wikidata-api






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked May 11 '16 at 18:02









PatrickPatrick

7462922




7462922













  • What are you expecting to see?

    – Padraic Cunningham
    May 11 '16 at 22:36











  • Same results as those returned when you enter 'New York Landmarks Preservation Commission' in the Wikidata search box, in this case: New York City Landmark (Q19825927) and New York City Landmarks Preservation Commission (Q967276).

    – Patrick
    May 12 '16 at 17:47



















  • What are you expecting to see?

    – Padraic Cunningham
    May 11 '16 at 22:36











  • Same results as those returned when you enter 'New York Landmarks Preservation Commission' in the Wikidata search box, in this case: New York City Landmark (Q19825927) and New York City Landmarks Preservation Commission (Q967276).

    – Patrick
    May 12 '16 at 17:47

















What are you expecting to see?

– Padraic Cunningham
May 11 '16 at 22:36





What are you expecting to see?

– Padraic Cunningham
May 11 '16 at 22:36













Same results as those returned when you enter 'New York Landmarks Preservation Commission' in the Wikidata search box, in this case: New York City Landmark (Q19825927) and New York City Landmarks Preservation Commission (Q967276).

– Patrick
May 12 '16 at 17:47





Same results as those returned when you enter 'New York Landmarks Preservation Commission' in the Wikidata search box, in this case: New York City Landmark (Q19825927) and New York City Landmarks Preservation Commission (Q967276).

– Patrick
May 12 '16 at 17:47












1 Answer
1






active

oldest

votes


















3














The search box in the top right of Wikidata uses the wbsearchentities API module to provide the auto suggestion dropdown search.



If you press enter after entering your search instead of clicking on one of the suggestions you will end up on the Special:Search page.



As you can see they API result returns no results but the special page does.



That is due to these searches working in entirely different ways.




  • The Special:Search page is a MediaWiki concept that Wikibase provides
    data to.

  • The wbsearchentities API module provided by Wikibase itself.






share|improve this answer
























  • So there is no way to get the special:search results with an API?

    – Patrick
    May 16 '16 at 14:24








  • 1





    See action=query&list=search wikidata.org/w/…

    – Addshore
    May 19 '16 at 9:30













Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f37170179%2fwikidata-api-wbsearchentities-why-are-results-not-the-same-in-python-than-in-wi%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









3














The search box in the top right of Wikidata uses the wbsearchentities API module to provide the auto suggestion dropdown search.



If you press enter after entering your search instead of clicking on one of the suggestions you will end up on the Special:Search page.



As you can see they API result returns no results but the special page does.



That is due to these searches working in entirely different ways.




  • The Special:Search page is a MediaWiki concept that Wikibase provides
    data to.

  • The wbsearchentities API module provided by Wikibase itself.






share|improve this answer
























  • So there is no way to get the special:search results with an API?

    – Patrick
    May 16 '16 at 14:24








  • 1





    See action=query&list=search wikidata.org/w/…

    – Addshore
    May 19 '16 at 9:30


















3














The search box in the top right of Wikidata uses the wbsearchentities API module to provide the auto suggestion dropdown search.



If you press enter after entering your search instead of clicking on one of the suggestions you will end up on the Special:Search page.



As you can see they API result returns no results but the special page does.



That is due to these searches working in entirely different ways.




  • The Special:Search page is a MediaWiki concept that Wikibase provides
    data to.

  • The wbsearchentities API module provided by Wikibase itself.






share|improve this answer
























  • So there is no way to get the special:search results with an API?

    – Patrick
    May 16 '16 at 14:24








  • 1





    See action=query&list=search wikidata.org/w/…

    – Addshore
    May 19 '16 at 9:30
















3












3








3







The search box in the top right of Wikidata uses the wbsearchentities API module to provide the auto suggestion dropdown search.



If you press enter after entering your search instead of clicking on one of the suggestions you will end up on the Special:Search page.



As you can see they API result returns no results but the special page does.



That is due to these searches working in entirely different ways.




  • The Special:Search page is a MediaWiki concept that Wikibase provides
    data to.

  • The wbsearchentities API module provided by Wikibase itself.






share|improve this answer













The search box in the top right of Wikidata uses the wbsearchentities API module to provide the auto suggestion dropdown search.



If you press enter after entering your search instead of clicking on one of the suggestions you will end up on the Special:Search page.



As you can see they API result returns no results but the special page does.



That is due to these searches working in entirely different ways.




  • The Special:Search page is a MediaWiki concept that Wikibase provides
    data to.

  • The wbsearchentities API module provided by Wikibase itself.







share|improve this answer












share|improve this answer



share|improve this answer










answered May 14 '16 at 10:38









AddshoreAddshore

401311




401311













  • So there is no way to get the special:search results with an API?

    – Patrick
    May 16 '16 at 14:24








  • 1





    See action=query&list=search wikidata.org/w/…

    – Addshore
    May 19 '16 at 9:30





















  • So there is no way to get the special:search results with an API?

    – Patrick
    May 16 '16 at 14:24








  • 1





    See action=query&list=search wikidata.org/w/…

    – Addshore
    May 19 '16 at 9:30



















So there is no way to get the special:search results with an API?

– Patrick
May 16 '16 at 14:24







So there is no way to get the special:search results with an API?

– Patrick
May 16 '16 at 14:24






1




1





See action=query&list=search wikidata.org/w/…

– Addshore
May 19 '16 at 9:30







See action=query&list=search wikidata.org/w/…

– Addshore
May 19 '16 at 9:30




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f37170179%2fwikidata-api-wbsearchentities-why-are-results-not-the-same-in-python-than-in-wi%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Monofisismo

Angular Downloading a file using contenturl with Basic Authentication

Olmecas