문제

i was using mediawiki opensearch api for wikipedia opensearch like

http://en.wikipedia.org/w/api.php?action=opensearch&search=a&limit=10&namespace=0&format=jsonfm

eg: for query string "a" which returns

[
"a",
[
    "Animal",
    "Association football",
    "Australia",
    "Allmusic",
    "African American (U.S. Census)",
    "Arthropod",
    "Album",
    "Actor",
    "Austria",
    "American football"
]
    ]

is there a way to remove all locations from fetched results like in above case `

[
    "Australia",
    "Austria"
]

Is there any relevant parameter to add to query string to avoid locations from search?,Thanks

도움이 되었습니까?

해결책

No, it is not possible. Have a look into the docs you've linked yourself ;-)

The opensearch api is a quick-responding api to be used in autocomplete-inputs etc. Therefore, you will have no filter options than the namespace.

If you want to filter them, you should build your own database where locations can be put apart from "normal" articles, and create an API to that database. Then you will be in control over the definition of a "location", too.

If you want to extract metadata about the searched articles, you may have a look at the (query-) search api. You can use that list as a generator and get the categories (which might help to filter locations) of the found articles, for example. Or get embedded templates and look for {{coord}}.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top