Freebase search_api and excluding results by specified type

僤鯓⒐⒋嵵緔 提交于 2019-12-08 04:46:38

问题


is anyone know, how to exclude some topics with specified type(s) using search api and mql?

For example i'm try to find all topics "Voodoo People", and exclude only those, that have composition and release types, and sort result by score desc: http://tinyurl.com/3tjkb7y. Sorting work perfect, but i can't find functionality for excluding :( I'm try to use mql_filter: http://tinyurl.com/644xkow, but releases still there. And one more question: i see in type_strict param possible values: "all", "any", "should". But there is no value "not" or "not in". Is needed result can be obtained in any other way?


回答1:


The syntax that you're looking for is "optional" : "forbidden". In your query that would look like this:

[{
  "search": {
    "query": "Voodoo People",
    "score": null,
    "mql_filter": [{
      "type": {
        "id":       "/music/release",
        "optional": "forbidden"
      }
    }]
  },
  "name":  null,
  "id":    null,
  "type":  [],
  "/common/topic/notable_for": {
  },
  "limit": 15,
  "sort":  "-search.score"
}]​


来源:https://stackoverflow.com/questions/5883933/freebase-search-api-and-excluding-results-by-specified-type

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!