searchclienttest.java

来自「yahoo api,包括各版本的」· Java 代码 · 共 30 行

JAVA
30
字号
package com.yahoo.search;import java.io.IOException;public class SearchClientTest {    private static final String SHORT_CONTENT = "This is some really short content";    private static final String LONG_CONTENT = "This is some really long content that " +            "ought to force the RestClient to switch from GET to POST. That way I can " +            "test to make sure it's doing that automagically like it ought to be. If " +            "it's not doing what I want it to do, then I need to fix the bug. It would " +            "be bad to let that get out to the users. They would probably have my head " +            "if I screwed with them like that. So I'll just test it now and make sure it " +            "works so there's no issues with them claiming my head. I think this is more " +            "than 255 characters, so I'll stop typing right now.";    public static void main(String[] args) throws IOException, SearchException {        SearchClient client = new SearchClient("javasdktest");        ContextSearchRequest request = new ContextSearchRequest(SHORT_CONTENT);        WebSearchResults results = client.contextWebSearch(request);        System.out.println("results.getTotalResultsAvailable() = " + results.getTotalResultsAvailable());        request = new ContextSearchRequest(LONG_CONTENT);        results = client.contextWebSearch(request);        System.out.println("results.getTotalResultsAvailable() = " + results.getTotalResultsAvailable());    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?