3

If I make a request using the "tagged" parameter, the returned results are more that if I make the same request with the same tags but using the "q" parameter.

Notice that the behaviour of requests with the tagged parameter is not as described in the documentation. It works just like an AND filter, so the returned result should be exactly the same as if making a request with the q parameter and the AND filter. (See here: Tagged parameter not working as described in documentation)

Examples:

This request: https://api.stackexchange.com/2.3/search/advanced?pagesize=100&order=desc&sort=activity&accepted=True&views=50&site=english&tagged=grammar%3Bmeaning%3Bsingle-word-requests

Gives 7 results, all tagged with the 3 tags.

This request should give the same results: https://api.stackexchange.com/2.3/search/advanced?pagesize=100&order=desc&sort=activity&accepted=True&views=50&site=english&q=%5Bgrammar%5D%20and%20%5Bmeaning%5D%20and%20%5Bsingle-word-requests%5D

But it only returns 3 results.

1 Answer 1

1

This request should give the same results

Not really; you should leave out the ands in the q parameter. Your second request is equivalent to this search on the site: https://english.stackexchange.com/search?q=%5Bgrammar%5D+and+%5Bmeaning%5D+and+%5Bsingle-word-requests%5D+hasaccepted%3Ayes, which gives three results. Instead, https://english.stackexchange.com/search?q=%5Bgrammar%5D+%5Bmeaning%5D+%5Bsingle-word-requests%5D+hasaccepted%3Ayes gives seven results. The other four results simply don't include the word 'and'.

2
  • Oooh, thank you man! I thought that, because you have to use the OR operator to make a search for questions tagged with SOME tags, then you had to use the AND operator in a search for questions that include ALL the tags. Turns out the AND operator does not exists, it is 'automatic'. Thank you for clarifying that. Do you know if there is some documentation explaining the use of "q" more in detail? I can't seem to find it.
    – micpob
    Commented Dec 29, 2022 at 23:12
  • 1
    Yeah, confusing :) I don't know of any official documentation, but it's pretty much the same as the site search, so I always check the Help Center.
    – Glorfindel
    Commented Dec 30, 2022 at 7:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .