2

I'm using Bing API to search for images by going the following call:

http://api.bing.net/json.aspx?AppId=[my key]&sources=image&version=2.2&query=[search term]&image.count=4&adult=strict&Image.Filters=Style:Photo&Image.Filters=Face:Face

This is working great and returns photos with faces (thanks to parameter &Image.Filters=Face:Face) matching the searched term. What I would like is to also get the portraits (head and shoulders) which can be done with the parameter:

&Image.Filters=Face:Portrait

Unfortunately the two parameters combined cancel each other.

Does anyone know how to do a OR? i.e. list all photos which are either face or portrait?

pnuts
  • 58,317
  • 11
  • 87
  • 139
Johann
  • 12,158
  • 11
  • 62
  • 89

2 Answers2

4

I was looking for an answer to this, as well. I don't think you're looking for an "or" search, really. It seems like you want images that are both photos AND faces. Here's what you want:

Image.Filters=Style:Photo+Face:Face

If you want to set a parameter to multiple values, separate them with a plus sign (+).

Here's where you can find the documentation:

http://msdn.microsoft.com/en-us/library/dd250846.aspx

Sadly, this didn't work for me. I wanted to use the Size:Small and Size:Medium filters together, to get searches that are either/or. You can't do that, as far as I can tell :)

Jaime Bellmyer
  • 23,051
  • 7
  • 53
  • 50
  • Thanks for your post but I don't it answers my question! I know how to get photo + face with &Image.Filters=Style:Photo&Image.Filters=Face:Face. What I need is images that are either Face OR Portrait! – Johann Oct 10 '11 at 09:29
  • @Johann, your parameters above won't even accomplish an "AND" search, because you can't specify the same parameter twice in a url. My answer above shows how to properly set two filters, but you're right - it won't do an "OR" search. – Jaime Bellmyer Feb 26 '14 at 22:18
0

It seems like you currently need to do two different searches to do an OR search. A little annoying, but works well.

Emil Stenström
  • 13,329
  • 8
  • 53
  • 75