次の方法で共有


SourceRequest.SearchTagFilters プロパティ (Search)

クエリによって返される SearchTags の一覧を限定するために使用されるフィルタの文字列配列を指定します。指定しない場合、クエリの結果がそのまま返されます。

構文

[XmlArrayItemAttribute(IsNullable=false)] 
public string[] SearchTagFilters { get; set; }

解説

SearchTagFilters は、コンマで区切られて指定される SearchTag の Name と Value のペア、およびクエリによって返される SearchTag オブジェクトの配列に適用されます。検索タグは、SourceTypeWeb または News の場合に返されます。

この例では、1 つの要素から構成される SearchTagFilters 配列を使用して News SourceType からの情報を要求し、それらの情報をコンソール ウィンドウに表示します。以下では、SearchTagFilters 要求コードを太字で示しています。

try
{
MSNSearchService s = new MSNSearchService();
SearchRequest searchRequest = new SearchRequest();
int arraySize = 1;
SourceRequest[] sr = new SourceRequest[arraySize];

sr[0] = new SourceRequest();
sr[0].Source = SourceType.News;
sr[0].ResultFields = ResultFieldMask.All | ResultFieldMask.SearchTagsArray | ResultFieldMask.Source;
    string[] strFilter = new string[1];
    strFilter[0] = "search.title";
    sr[0].SearchTagFilters = strFilter;

searchRequest.Query = "msnbc";
searchRequest.Requests = sr;
// Developer Provisioning System で指定されたアプリケーション ID を 二重引用符で囲って 
// SearchRequest の AppID の値として入力します。
searchRequest.AppID = "YOUR_APP_ID_GOES_HERE";
searchRequest.CultureInfo = "en-US";

SearchResponse searchResponse;

searchResponse = s.Search(searchRequest);
foreach (SourceResponse sourceResponse in searchResponse.Responses)
    {
Result[] sourceResults = sourceResponse.Results;
if (searchResponse.Responses[0].Total > 0)
        {
Console.WriteLine(sourceResponse.Source.ToString() + " - 結果総数:" + sourceResponse.Total.ToString());
Console.WriteLine();
        }
foreach (Result sourceResult in sourceResults)
        {
if ((sourceResult.Title != null) && (sourceResult.Title != String.Empty))
Console.WriteLine("タイトル:" + sourceResult.Title);
if ((sourceResult.Description != null) && (sourceResult.Description != String.Empty))
Console.WriteLine("説明:" + sourceResult.Description);
if ((sourceResult.Url != null) && (sourceResult.Url != String.Empty))
Console.WriteLine("Url:" + sourceResult.Url);
if ((sourceResult.Source != null) && (sourceResult.Source != String.Empty))
Console.WriteLine("ソース:" + sourceResult.Source);
if (sourceResult.SearchTagsArray != null)
            {
Console.WriteLine("SearchTagsArray (長さ " + sourceResult.SearchTagsArray.Length.ToString() + ")");
int counter = 0;
foreach (SearchTag nameValuePair in sourceResult.SearchTagsArray)
                {
Console.WriteLine("SearchTagsArray[" + counter.ToString() + "] 名前 (Name):" + nameValuePair.Name);
Console.WriteLine("SearchTagsArray[" + counter.ToString() + "] 値 (Value):" + nameValuePair.Value);
counter++;
                }
            }
Console.WriteLine("*****************************************************");
        }
Console.WriteLine("終了するにはいずれかのキーを押してください。");
Console.ReadLine();
    }
}
catch (SoapException fault)
{
Console.WriteLine(fault.Detail.InnerText.ToString());
Console.WriteLine("終了するにはいずれかのキーを押してください。");
Console.ReadLine();
}
catch (WebException webx)
{
Console.WriteLine(webx.ToString());
}

以下の出力の例は、このクエリの結果を示します。

News - 結果総数: 134546

タイトル:Intel reveals al-Qaida U.S. attack plan

説明:U.S. military and counterterrorism officials have told NBC News that a recent U.S. raid on an al-Qaida safehouse in Iraq ...NBC News' Jim Miklaszewski and Pete Williams and MSNBC's Robert Windrem contributed to this report.

Url:https://www.msnbc.msn.com/id/16757401/

ソース:MSNBC

SearchTagsArray (長さ 10)

SearchTagsArray[0] 名前 (Name):search.title

SearchTagsArray[0] 値 (Value):"Captured intel reveals al-Qaida U.S. attack plan"

SearchTagsArray[1] 名前 (Name):search.title

SearchTagsArray[1] 値 (Value):captured

SearchTagsArray[2] 名前 (Name):search.title

SearchTagsArray[2] 値 (Value):intel

SearchTagsArray[3] 名前 (Name):search.title

SearchTagsArray[3] 値 (Value):reveals

SearchTagsArray[4] 名前 (Name):search.title

SearchTagsArray[4] 値 (Value):al

SearchTagsArray[5] 名前 (Name):search.title

SearchTagsArray[5] 値 (Value):qaida

SearchTagsArray[6] 名前 (Name):search.title

SearchTagsArray[6] 値 (Value):u

SearchTagsArray[7] 名前 (Name):search.title

SearchTagsArray[7] 値 (Value):s

SearchTagsArray[8] 名前 (Name):search.title

SearchTagsArray[8] 値 (Value):attack

SearchTagsArray[9] 名前 (Name):search.title

SearchTagsArray[9] 値 (Value):plan

*****************************************************

タイトル:Colts' Manning ditches demons

説明:Peyton Manning is congratulated by teammate Adam Vinatieri.By winning the AFC title, Manning answered all of his critics, writes MSNBC.com's Bob Cook.   ...

Url:https://www.msnbc.msn.com/id/16746776/

ソース:MSNBC

SearchTagsArray (長さ 9)

SearchTagsArray[0] 名前 (Name):search.title

SearchTagsArray[0] 値 (Value):"Manning answered all his critics with 1 game"

SearchTagsArray[1] 名前 (Name):search.title

SearchTagsArray[1] 値 (Value):Manning

SearchTagsArray[2] 名前 (Name):search.title

SearchTagsArray[2] 値 (Value):answered

SearchTagsArray[3] 名前 (Name):search.title

SearchTagsArray[3] 値 (Value):all

SearchTagsArray[4] 名前 (Name):search.title

SearchTagsArray[4] 値 (Value):his

SearchTagsArray[5] 名前 (Name):search.title

SearchTagsArray[5] 値 (Value):critics

SearchTagsArray[6] 名前 (Name):search.title

SearchTagsArray[6] 値 (Value):with

SearchTagsArray[7] 名前 (Name):search.title

SearchTagsArray[7] 値 (Value): 1

SearchTagsArray[8] 名前 (Name):search.title

SearchTagsArray[8] 値 (Value):game

*****************************************************

タイトル:Universal Express to Be Featured on National Radio Show Tonight

説明:Sid will be covering the Super Bowl in Miami for sports radio 790AM the Ticket as well as appear on "The Imus Show" on MSNBC all week long as well as over 140 national radio stations.He also broadcasts his own radio show daily in South Florida ...

Url:http://news.moneycentral.msn.com/provider/providerarticle.aspx?Feed=BW&Date

=20070122&ID=6370759

ソース:MSN MoneyCentral

*****************************************************

タイトル:Allied Energy Group, Inc. Announces Today's Release of Terry

説明:AGGI) is proud to announce today's release of its "Winners Circle" Featured Interview hosted by NFL Hall of Fame member Terry Bradshaw. Mr. Bradshaw's interview with Cole Halliburton, President of Allied Energy Group, Inc., aired on MSNBC this ...

Url:http://news.moneycentral.msn.com/provider/providerarticle.aspx?Feed=MW&Date

=20070122&ID=6368779

ソース:MSN MoneyCentral

*****************************************************

タイトル:Apple prosecutors quit government jobs

説明:A new report has revealed that two of the federal prosecutors investigating stock options backdating at Apple have left their government jobs for work in the private sector.MSNBC reports that Chris Steskal, who was a member of the federal task force ...

Url:http://www.macnn.com/print/41215

ソース:MacNN

*****************************************************

タイトル:Build your own iTunes store!

説明:Perhaps a byproduct of Apple's growing popularity, Apple is starting to face angry interest groups in Europe, albeit in subtantially lesser form than the opprobrium normally directed at Microsoft.According to an article on MSNBC , German and French ...

Url:http://blogs.zdnet.com/carroll/?p=1633

ソース:ZDNet Blogs

*****************************************************

タイトル:negative factions are trying to steal the Elvis Cup..please read

説明:I've been in TIME, NEWSWEEK, USA Today,US Weekly,Rolling Stone,CNN, FOX News,MSNBC,Tonight Show w/Jay Leno,the BBC..and tons of websites,newspapers,and radio/news shows around the world.Renelvis and I are on tour..making public appearanaces..He ...

Url:http://www.pr-inside.com/negative-factions-are-trying-to-steal-the-elvis-cu

p-please-read-r42919.htm

ソース:PR Inside

*****************************************************

タイトル:NBC News Chief Takes Swipe at O'Reilly

説明:Steve Capus attributed the Fox News Channel host's criticism of the network to O'Reilly's ongoing feud with MSNBC's Keith Olbermann.O'Reilly has said NBC News, as an organization, has gone sharply to the left.He cited the network's decision last ...

Url:http://www.cbsnews.com/stories/2007/01/18/ap/entertainment/mainD8MNDU0O0.sh

tml

ソース:CBS News

*****************************************************

タイトル:Julie Rovner, NPR Biography

説明:Rovner has appeared on television on the MacNeil/Lehrer NewsHour, CNN, C-Span, MSNBC, and NOW with Bill Moyers .Her articles have appeared in dozens of national newspapers and magazines, including The Washington Post , USA Today , Modern Maturity , and ...

Url:http://www.npr.org/templates/story/story.php?storyId=2101102

ソース:NPR News

*****************************************************

タイトル:George W. Bush

説明:MSNBC's Keith Olbermann continued his fevered attack on all things Republican and conservative.He's now accused White House Press Secretary Tony Snow of "bald-faced lying" about a Bush speech.Olbermann's cohort in liberalism, Chris Matthews ...

Url:http://newsbusters.org/taxonomy/term/440

ソース:News Busters

*****************************************************

終了するにはいずれかのキーを押してください。