현재 하늘 검색 API를 호출해야하는 애플리케이션을 만들고 있습니다. "@odata.nextLink": "https://serviceName.search.windows.net/indexes('global-index')/docs?api-version=2015-02-28-Preview&search=%28test%7C%7Ctest%7C%7Ctest%7C%7Ctest%7C%7Ctest%7C%7Ctest%7C%7Ctest%29%2B%20Contacts%2BCampaigns%2BCompanies%2BTargets%2BComplanits%2BClaims%2BActivities%2BOpportunities%2BCompleted%20Activities&$skip=50"
Azure Search에서 다음 레코드를 가져 오는 링크를 얻는 방법은 무엇입니까?
@Override
public JSONObject global(SearchParametersDto searchInTableDto) {
JSONObject jsonOutput = new JSONObject();
ArrayList encodedURLList = new ArrayList < >();
try {
String url = "https://" + searchInTableDto.getServiceName().toString() + ".search.windows.net/indexes/" +
searchInTableDto.getIndexName().toString() + "/docs/search?api-version=2016-09-01";
HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost(url);
post.setHeader("Content-Type", "application/json");
post.setHeader("api-key", searchInTableDto.getApiKey().toString());
String clientId = searchInTableDto.getClientId().toString();
String updatedClientId = " \"+" + clientId + "\" ";
JSONObject jsonInput = new JSONObject();
jsonInput.put("search", "(test||test||test||test||test||test||test)+ Contacts+Campaigns+Companies+Targets+Complanits+Claims+Activities+Opportunities+Completed Activities");
//jsonInput.put("top", 1000);
System.out.println(jsonInput);
post.setEntity(new StringEntity(jsonInput.toString(), ContentType.create("application/json")));
HttpResponse response = client.execute(post);
BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
StringBuffer resultOutput = new StringBuffer();
String line = "";
while ((line = rd.readLine()) != null) {
resultOutput.append(line);
}
JSONParser parser = new JSONParser();
jsonOutput = (JSONObject) parser.parse(resultOutput.toString());
org.json.simple.JSONArray valuesArray = (org.json.simple.JSONArray) jsonOutput.get("value");
//jsonOutput.put("searchResult", valuesArray);
System.out.println(valuesArray.size());
} catch (Exception e) {
e.printStackTrace();
String errorMessageAndClassWithMethod = getErrorContainingClassAndMethod();
throw new SpringAppRuntimeException(errorMessageAndClassWithMethod + e.toString());
}
return jsonOutput;
}
, 나는 같은 다음의 결과에 대한 링크를 얻을 : 여기 https://serviceName.search.windows.net/indexes/global-index/docs/search?api-version=2016-09-01
내 자바 코드 : 여기
는 API입니다하지만 Java 서비스를 통해 동일한 쿼리를 실행하면 다음 문서에 대한 링크를 따라 가야합니다.
"@odata.nextLink": "https://serviceName.search.windows.net/indexes('global-index')/docs/search.post.search?api-version=2016-09-01"
두 번째 링크로 다음 문서를 가져올 수 없습니다. JSON 객체의 링크가 실제 필요한 링크와 다른 이유는 무엇입니까? 내 코드를 통해 "최고"의 조건을 넣을 때
또 다른 한가지는, 는, 결과는 나에게 이것에 대한 이유가 될 수 있습니다 다음 document.What에 대한 링크를 반환하지?
JSON 출력의 다음 문서를 보려면 어떻게 링크해야합니까?
감사합니다. 총 카운트를 얻은 후에 JAVA 로직을 구현하는 것은 쉽습니다. 현재 2123 개의 문서 (결과에서 JSON 객체)를 가져와야합니다. 검색 쿼리를 실행 한 후 결과가 전체적으로 표시 될 수있는 방법이 있습니까? –
$ count = true를 사용하십시오. 모든 Search API 매개 변수는 다음 사이트에서 설명합니다. https://docs.microsoft.com/rest/api/searchservice/search-documents#request –