質問

人を検索する際に音声結果を返すカスタムキーワードクエリを取得できないようです。

高速検索がインストールされており、「Jon」を検索する(高速検索センターで)人々を検索すると、「Jon」と「John」の両方を含む予想される結果が得られます。ただし、キーワードクエリを作成した場合(以下に示すように)、「Jon」の結果のみを返します。

助言がありますか?

using (SPSite spSite = new SPSite("http://localhost"))
{   
    // get the query and settings service proxy
    SearchQueryAndSiteSettingsServiceProxy settingsProxy = spSite.WebApplication.Farm.ServiceProxies.GetValue<SearchQueryAndSiteSettingsServiceProxy>();
    // get the search service application proxy by name
    SearchServiceApplicationProxy proxy = settingsProxy.ApplicationProxies.GetValue<SearchServiceApplicationProxy>("FAST Query SSA");

    KeywordQuery keywordQuery = new KeywordQuery(proxy);
    keywordQuery.RowLimit = 100;
    keywordQuery.EnablePhonetic = true;
    keywordQuery.EnableNicknames = true;
    keywordQuery.ResultsProvider = SearchProvider.SharepointSearch;

    keywordQuery.ResultTypes = ResultType.RelevantResults;

    keywordQuery.SelectProperties.Add("firstname");
    keywordQuery.SelectProperties.Add("lastname");

    keywordQuery.QueryText = "jon";

    ResultTableCollection fullTextSearchResults = keywordQuery.Execute();

    if (fullTextSearchResults.Exists(ResultType.RelevantResults))
    {               
        ResultTable searchResult = fullTextSearchResults[ResultType.RelevantResults];
        Console.WriteLine("Total Rows: " + searchResult.TotalRows) ;
        Console.WriteLine("Total Row Count: " + searchResult.RowCount);
        Console.WriteLine("Total Rows Including Duplicates: " + searchResult.TotalRowsIncludingDuplicates);
        Console.WriteLine("Is Total Rows Exact: " + searchResult.IsTotalRowsExact);
    }
}   
役に立ちましたか?

解決

私は見つけました ブログ 誰かがあなたが設定する必要があるという事実を参照した場所 RankingModelId KeyWordQueryで。これは、上記のサンプルコードと、私が作成したカスタム拡張CoreSearchResults Webパーツで機能します。

これがサンプルコードです:

using (SPSite spSite = new SPSite("http://localhost"))
{   
    SearchQueryAndSiteSettingsServiceProxy settingsProxy = spSite.WebApplication.Farm.ServiceProxies.GetValue<SearchQueryAndSiteSettingsServiceProxy>();
    SearchServiceApplicationProxy proxy = settingsProxy.ApplicationProxies.GetValue<SearchServiceApplicationProxy>("FAST Query SSA");

    KeywordQuery keywordQuery = new KeywordQuery(proxy);
    keywordQuery.RowLimit = 100;
    keywordQuery.EnablePhonetic = true;
    keywordQuery.EnableNicknames = true;
    keywordQuery.ResultsProvider = SearchProvider.SharepointSearch;

    keywordQuery.RankingModelId = "D9BFB1A1-9036-4627-83B2-BBD9983AC8A1";       

    keywordQuery.ResultTypes = ResultType.RelevantResults;

    keywordQuery.SelectProperties.Add("firstname");
    keywordQuery.SelectProperties.Add("lastname");

    keywordQuery.QueryText = "jon";

    ResultTableCollection fullTextSearchResults = keywordQuery.Execute();

    if (fullTextSearchResults.Exists(ResultType.RelevantResults))
    {               
        ResultTable searchResult = fullTextSearchResults[ResultType.RelevantResults];
        Console.WriteLine("Total Rows: " + searchResult.TotalRows) ;
        Console.WriteLine("Total Row Count: " + searchResult.RowCount);
        Console.WriteLine("Total Rows Including Duplicates: " + searchResult.TotalRowsIncludingDuplicates);
        Console.WriteLine("Is Total Rows Exact: " + searchResult.IsTotalRowsExact);
    }
}   

他のヒント

ResultsProvider値を「FastSearch」に変更するのはどうですか?

Webサービスを通じてこれをやろうとしている人のために、あなたが必要とする要素には名前が付けられています RelevanceModel それ以外の RankingModelId

私はそれをjqueryを通して動作させようとして立ち往生していました spservices 私が見つけるまで Microsoft.Search.Query Schema 要素名は参照して発見されました RelevanceModel Webサービスコールを実行するとき。参照には言及されていません EnableNicknames また EnablePhonetic, 、しかし、私は彼らがこれを機能させるために必要であることがわかった。

これが私が終わったXMLクエリです:

<QueryPacket Revision="1000">'
    <Query>
        <Context>
            <QueryText language="en-US" type="STRING">Jon scope:"People" </QueryText>
        </Context>
        <SupportedFormats Format="urn:Microsoft.Search.Response.Document.Document" />
        <ResultProvider>SharepointSearch</ResultProvider>
        <EnableNicknames>true</EnableNicknames>
        <EnablePhonetic>true</EnablePhonetic>
        <RelevanceModel>d9bfb1a1-9036-4627-83b2-bbd9983ac8a1</RelevanceModel>
        <Properties>
            ...
            <Property name="FirstName" />
            <Property name="LastName" />
        </Properties>
    </Query>
</QueryPacket>
ライセンス: CC-BY-SA帰属
所属していません sharepoint.stackexchange
scroll top