This repository is for active development of the Azure SDK for Java. For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/java/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-java.
MIT License
2.36k
stars
2k
forks
source link
[BUG][Autosuggest] Autosuggest method path is only '/Suggestions'; should be '/bing/v7.0/Suggestions' #4560
Describe the bug
The path for autosuggest method is '/Suggestions'. It should be '/bing/v7.0/Suggestions'.
Exception or Stack Trace
No exception, but the call to BingAutoSuggestSearchAPI.bingAutoSuggestSearch().autoSuggest().withQuery("xb").execute() returns null for a query that returns results in other languages and in the API testing console.
To Reproduce
Steps to reproduce the behavior:
Copy the contents of pom.xml below into a file named pom.xml.
Copy the contents of quickstart.java below into a file named quickstart.java.
First suggestion group: Web
Suggestions:
Query: xbox
Text: xbox
URL: https://www.bing.com/search?q=xbox&FORM=USBAPI
Kind: WebSearch
Query: xbox game pass
Text: xbox game pass
URL: https://www.bing.com/search?q=xbox+game+pass&FORM=USBAPI
Kind: WebSearch
Query: xbox reddit
Text: xbox reddit
URL: https://www.bing.com/search?q=xbox+reddit&FORM=USBAPI
Kind: WebSearch
Query: xbox live
Text: xbox live
URL: https://www.bing.com/search?q=xbox+live&FORM=USBAPI
Kind: WebSearch
Query: xbox one x
Text: xbox one x
URL: https://www.bing.com/search?q=xbox+one+x&FORM=USBAPI
Kind: WebSearch
Query: xbox one
Text: xbox one
URL: https://www.bing.com/search?q=xbox+one&FORM=USBAPI
Kind: WebSearch
Query: xbox app
Text: xbox app
URL: https://www.bing.com/search?q=xbox+app&FORM=USBAPI
Kind: WebSearch
Query: xbox game pass ultimate
Text: xbox game pass ultimate
URL: https://www.bing.com/search?q=xbox+game+pass+ultimate&FORM=USBAPI
Kind: WebSearch
Setup (please complete the following information):
OS: Windows 10 Enterprise 1803
IDE : None
Version of the Library used
azure-cognitiveservices-autosuggest-1.0.2-beta
Additional context
I am able to resolve the issue and get the expected output as follows.
In [My Github base folder]\azure-sdk-for-java\cognitiveservices\data-plane\search\bingautosuggest\src\main\java\com\microsoft\azure\cognitiveservices\search\autosuggest\implementation\BingAutoSuggestSearchImpl.java, change line 62 from:
@GET("Suggestions")
to:
@GET("/bing/v7.0/Suggestions")
Recompile azure-cognitiveservices-autosuggest-1.0.2-beta.jar from my modified source and place it in the lib subfolder of my project folder (where quickstart.java is).
Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report
Describe the bug The path for autosuggest method is '/Suggestions'. It should be '/bing/v7.0/Suggestions'.
Exception or Stack Trace No exception, but the call to
BingAutoSuggestSearchAPI.bingAutoSuggestSearch().autoSuggest().withQuery("xb").execute()
returnsnull
for a query that returns results in other languages and in the API testing console.To Reproduce Steps to reproduce the behavior:
pom.xml
below into a file namedpom.xml
.quickstart.java
below into a file namedquickstart.java
.mvn clean dependency:copy-dependencies
javac Quickstart.java -cp .;lib\*
java -cp .;lib\* Quickstart
Note This also causes me to get a null response when running the sample at https://github.com/Azure-Samples/cognitive-services-java-sdk-samples/blob/master/Search/BingAutoSuggest/src/main/java/com/microsoft/azure/cognitiveservices/search/autosuggest/samples/BingAutoSuggestSample.java.
Code Snippet pom.xml:
quickstart.java:
Expected behavior Expected output:
Setup (please complete the following information):
Additional context I am able to resolve the issue and get the expected output as follows.
to:
lib
subfolder of my project folder (wherequickstart.java
is).There is a similar issue in the Azure SDK for Python (https://github.com/Azure/azure-sdk-for-python/issues/6472).
Information Checklist Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report