Bing web search api advanced query

289 Views Asked by At

I have a question about bing web search api :

I want use a filter in my query for :

  • articles + documents
  • articles only
  • documents only

Articles are html pages Documents are pdf, doc, docx, ... with /lfy/documents/ path

I have tried with ext parameter but he seems not work with ext:html

I try filtering by path (contains "/documents" for documents, don't contains /documents for web pages)

1/ Filter including site with syntax error

q=site:www.msa.fr/lfy/ Barèmes des cotisations sur sallaires

-> return results :-)

Altered query is : "alteredQuery": "barèmes des cotisations sur salaires"

sallaires become salaires : ok !

2/ Filter including site and excluding sub site with syntax error

q=site:www.msa.fr/lfy/ NOT site:www.msa.fr/lfy/documents Barèmes des cotisations sur sallaires

-> return no results

Adding NOT site: break the syntax correction

3/ Filter including site and excluding sub site without syntax error

q=site:www.msa.fr/lfy/ NOT site:www.msa.fr/lfy/documents Barèmes des cotisations sur salaires

-> return results

Adding "NOT site:xxx" break the syntax correction

Note : i use

  • responseFilter=Webpages
  • mkt=fr-fr
  • safesearch=Moderate

Every one have a solution ?

Thanks for your help.

Florian.

1

There are 1 best solutions below

1
On

You need to use "-" instead of "NOT". The below should work:

q=Barèmes des cotisations sur sallaires site:www.msa.fr/lfy/

q=Barèmes des cotisations sur sallaires site:www.msa.fr/lfy/ -site:www.msa.fr/lfy/documents