當前位置: 首頁>>代碼示例>>Java>>正文


Java AzureSearchWebResult類代碼示例

本文整理匯總了Java中net.billylieurance.azuresearch.AzureSearchWebResult的典型用法代碼示例。如果您正苦於以下問題:Java AzureSearchWebResult類的具體用法?Java AzureSearchWebResult怎麽用?Java AzureSearchWebResult使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AzureSearchWebResult類屬於net.billylieurance.azuresearch包,在下文中一共展示了AzureSearchWebResult類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: fromQuery2Weblist

import net.billylieurance.azuresearch.AzureSearchWebResult; //導入依賴的package包/類
public static List<String[]> fromQuery2Weblist(String query) {
	List<String[]> ret = new ArrayList<String[]>();
	AzureSearchWebQuery aq = new AzureSearchWebQuery();
	aq.setAppid("POQ8S/XONvSFxnUFrKANXTadRVzDAMN2E2cnCXmPOSM=");// 50,000
																// transactions
	// aq.setAppid("D4Makeg91kNY0ZuZ4SJBfNKQ69m/ay/VVwa+9NLTAIw=");//free
	// 5000 transactions
	aq.setQuery(query);
	aq.doQuery();
	AzureSearchResultSet<AzureSearchWebResult> ars = aq.getQueryResult();

	for (AzureSearchWebResult nsr : ars) {
		ret.add(new String[] {
				nsr.getUrl(), nsr.getTitle(),
				nsr.getDescription() });
	}
	return ret;
}
 
開發者ID:zhangcongle,項目名稱:NewsSpikeRe,代碼行數:19,代碼來源:BingAzureApi.java

示例2: buildQueryResult

import net.billylieurance.azuresearch.AzureSearchWebResult; //導入依賴的package包/類
/**
 *
 */
@Test(dependsOnMethods = {"TestConstructor", "TestAppid"})
public void buildQueryResult() {
    AzureSearchWebQuery aq = new AzureSearchWebQuery();
    aq.setBingApi(AZURESEARCH_API.BINGSEARCHWEBONLY);
    aq.setAppid(AzureAppid.AZURE_APPID);
    aq.setQuery("Oklahoma Sooners");

    logURL(aq);

    aq.doQuery();
    Document ad = aq.getRawResult();
    Assert.assertNotNull(ad);

    AzureSearchResultSet<AzureSearchWebResult> ars = aq.getQueryResult();
    Assert.assertNotNull(ars, "getQueryResult returned null");
    Assert.assertNotNull(ars.getASRs(), "getQueryResult.getASRs returned null");
    Assert.assertFalse(ars.getASRs().isEmpty(), "getQueryResult returned no results");

    asr = ars.getASRs().get(0);
    Assert.assertNotNull(asr, "Unparseable result from result.");

}
 
開發者ID:peculater,項目名稱:azure-bing-search-java,代碼行數:26,代碼來源:AzureSearchWebOnlyTest.java

示例3: buildQueryResult

import net.billylieurance.azuresearch.AzureSearchWebResult; //導入依賴的package包/類
/**
 *
 */
@Test(dependsOnMethods = {"TestConstructor", "TestAppid"})
public void buildQueryResult() {
    AzureSearchWebQuery aq = new AzureSearchWebQuery();
    aq.setAppid(AzureAppid.AZURE_APPID);
    aq.setDebug(true);
    aq.setQuery("Oklahoma Sooners");

    logURL(aq);

    aq.doQuery();
    Document ad = aq.getRawResult();
    Assert.assertNotNull(ad);

    AzureSearchResultSet<AzureSearchWebResult> ars = aq.getQueryResult();
    Assert.assertNotNull(ars, "getQueryResult returned null");
    Assert.assertNotNull(ars.getASRs(), "getQueryResult.getASRs returned null");
    Assert.assertFalse(ars.getASRs().isEmpty(), "getQueryResult returned no results");

    asr = ars.getASRs().get(0);
    Assert.assertNotNull(asr, "Unparseable result from result.");

}
 
開發者ID:peculater,項目名稱:azure-bing-search-java,代碼行數:26,代碼來源:AzureSearchWebTest.java

示例4: searchWordAndSave

import net.billylieurance.azuresearch.AzureSearchWebResult; //導入依賴的package包/類
@Override
protected void searchWordAndSave(String word){

    boolean breakFlag = false;
    AzureSearchWebQuery aq = new AzureSearchWebQuery();
    aq.setAppid(BabelConfig.getInstance().getConfigFromFile().bing());
    aq.setQuery(word + " AND \"Powered by phpBB\"" + " NOT lang:en");
    // The results are paged. You can get 50 results per page max.
    // This example gets 150 results
    aq.setPerPage(50);

    for (int i=1; !breakFlag ; i++) {
        aq.setPage(i);
        aq.doQuery();

        AzureSearchResultSet<AzureSearchWebResult> ars = aq.getQueryResult();
        numOfRequests.getAndIncrement();
        for (AzureSearchWebResult anr : ars) {
            BBJob job = new BBJob(anr.getUrl(),lang, logDb);
            try {
                if(job.isValid())
                    broker.put(job);
                else{
                    log.debug("Job not valid: " + job);
                }
            } catch (InterruptedException e) {
                log.error(e);
            }
        }
    }
}
 
開發者ID:gidim,項目名稱:Babler,代碼行數:32,代碼來源:BBSearchProducer.java

示例5: searchWordAndSave

import net.billylieurance.azuresearch.AzureSearchWebResult; //導入依賴的package包/類
@Override
protected void searchWordAndSave(String word){
    boolean breakFlag = false;
    int counter = 0;
    AzureSearchWebQuery aq = new AzureSearchWebQuery();
    aq.setAppid(BabelConfig.getInstance().getConfigFromFile().bing());//julia's key
    //aq.setAppid("8LcemWAvkBRUS/uVBsI0vQFDT74FfrgyiV+PTkPIjMw");
    aq.setQuery("site:blogspot.com " + " \""+word+"\"" + " NOT lang:en"); //site:blogspot.com "word"
    aq.setPerPage(50);
    // The results are paged. You can get 50 results per page max.
    for (int i=1; !breakFlag ; i++) {
        aq.setPage(i);
        aq.doQuery();
        AzureSearchResultSet<AzureSearchWebResult> ars = aq.getQueryResult();
        if(counter++ == 100 ||ars.getAsrs().size() == 0)
            breakFlag = true;
        numOfRequests.getAndIncrement();
        for (AzureSearchWebResult anr : ars) {
            BSJob job = new BSJob(anr.getUrl(),lang, logDb);
            try {
                if(job.isValid())
                    broker.put(job);
                else{
                    log.debug("Job not valid: " + job);
                }
            } catch (InterruptedException e) {
                log.error(e);
            }
        }
    }
}
 
開發者ID:gidim,項目名稱:Babler,代碼行數:32,代碼來源:BSSearchProducer.java

示例6: checkIsAWebResult

import net.billylieurance.azuresearch.AzureSearchWebResult; //導入依賴的package包/類
/**
 *
 */
@Test(dependsOnMethods = "buildQueryResult")
public void checkIsAWebResult() {
    Assert.assertTrue(asr instanceof AzureSearchWebResult);
}
 
開發者ID:peculater,項目名稱:azure-bing-search-java,代碼行數:8,代碼來源:AzureSearchCompositeTest.java


注:本文中的net.billylieurance.azuresearch.AzureSearchWebResult類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。