none
How to do a nested combination of && and || query for phrases in bing.

    Question

  • I want to write a query like: (term1 || term2) && (term3 || term4)

    where all terms are phrases like "Graphical user interface"

    But such a query is not giving expected results. Whats the right way of writing such a query in bing if it is possible.


    • Edited by ATulsian Friday, March 01, 2013 7:50 AM
    Thursday, February 28, 2013 12:05 PM

All replies

  • The exact query which I am using and which is going wrong is:

    ("Graphical user interface" | "Integrated circuit" | "Printed circuit board") & ("SAMSUNG ELECTRONICS" | "APPLE COMPUTER")

    The amazing point to note is, that the query mentioned below works instead of the one above although single quote(') is not even a valid bing construct.

    ('Graphical user interface' | 'Integrated circuit' | 'Printed circuit board') & ('SAMSUNG ELECTRONICS' | 'APPLE COMPUTER')

    I am completely confused. Please explain the weird behavior.

    Thursday, February 28, 2013 12:42 PM
  • Hi,

    Yes, Bing requires the single quote for the query parameter in uri. You can use %27 to replace ' in the url string instead.

    Thanks,


    QinDian Tang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, March 01, 2013 3:00 AM
    Moderator
  • Using the single quote does not guarantee me that the words "Graphical user interface" will occur together as a phrase. And when I use double quote bing does not seem to understand nesting of double quotes with parentheses. 

    As an example when I searched for:

    ("Graphical user interface" OR "Electronics" OR "User interface" OR "Integrated circuit") AND APPLE site:en.wikipedia.org

    The first result I got is : "en.wikipedia.org/wiki/Green_apples" which is obviously wrong.

    I need to know how can I combine phrases in a search like (A | B) & (C | D)  where all A,B,C,D are phrases.

    Friday, March 01, 2013 7:48 AM
  • Hi,

    As I known the searching for phrase is to add quotes around the phrases, which works for the single phrase like 'phrase sample'. I don't know if it works for the nested combination for several phrases. This forum is for Azure support (how to use Bing from marketplace), but your question is for Bing API. So I am not the expert for this part. Do you have any guide or reference to say "| or &" is valid or useful in query of Bing? If yes, please show me, so I can confirm it. As a common condition, I think Bing result first returns 100% matched result, then returns partial martched results and last returns the results which contain any word in phrase. So I think the result you get is normal which means Bing cannot find 100% matched results for your query. You can also try this community forum:

    http://www.bing.com/community/bingsearch/f/12244.aspx

    Sorry for the inconvenience, but hope your understanding.

    Thanks,


    QinDian Tang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, March 04, 2013 2:40 AM
    Moderator