Skip to main content
2 of 3
added 9 characters in body
Brock Adams
  • 13k
  • 5
  • 39
  • 64

The API currently does not support this, but then neither does the website itself.

The "How do I search?" help page says:

OR operator

To combine results from multiple tags, separate the tag names (enclosed in square brackets) with the word "or": [widgets] or [geegaws] returns questions tagged with either tag.

(Emphasis added)

Note that it only refers to tags in conjunction with the or operator. No facility is made for general or operation.

Here's a related feature request which you can/should upvote.


Example on the main site:

  1. Searching for [winzip] title:folder make gives 3 results (currently).
  2. Searching for [winzip] title:folder automate gives 1 result
  3. Searching for [winzip] title:folder make or automate gives no results, when it should give at least 3 (fail).
  4. [winzip] title:folder (make or automate), etc., also fail.

The API equivalents ([one][7], [two][8], [three][9]) give the same results.



###Workarounds:

The Most timely/accurate workaround is: for each of the optional terms, search separately and then combine the results (stripping duplicate matches).

For example:

  1. Suppose your keywords were: class and foo.
  2. [Search for title:http class][10] (only 3303 results, currently).
  3. [Search for title:http foo][11] (81 results).
  4. Repeat for each additional keyword.
  5. So we have 3384 gross results, then remove any duplicate question_ids for the final (net) results

This is annoying and inefficient, but it works and is easy to automate.


Other possible workarounds include using a [SEDE][12] query, or using a Google search with the `site:` parameter.

[7]: https://api.stackexchange.com/docs/advanced-search#order=desc&sort=activity&q=title%3Afolder%20make&tagged=winzip&filter=!C(oUnwUzi0Ii8GQ&site=stackoverflow&run=true [8]: https://api.stackexchange.com/docs/advanced-search#order=desc&sort=activity&q=title%3Afolder%20automate&tagged=winzip&filter=!C(oUnwUzi0Ii8GQ&site=stackoverflow&run=true [9]: https://api.stackexchange.com/docs/advanced-search#order=desc&sort=activity&q=title%3Afolder%20make%20or%20automate&tagged=winzip&filter=!C(oUnwUzi0Ii8GQ&site=stackoverflow&run=true [10]: https://api.stackexchange.com/docs/advanced-search#order=desc&sort=activity&q=title%3Ahttp%20class&tagged=java&filter=!C(oUnwUzi0Ii8GQ&site=stackoverflow&run=true [11]: https://api.stackexchange.com/docs/advanced-search#order=desc&sort=activity&q=title%3Ahttp%20foo&tagged=java&filter=!C(oUnwUzi0Ii8GQ&site=stackoverflow&run=true [12]: https://data.stackexchange.com/help

Brock Adams
  • 13k
  • 5
  • 39
  • 64