Skip to main content
RichRelevance

service/typeAhead

https://recs.richrelevance.com/rrserver/api/v1/service/typeAhead/{apiKey}?search=<searchTerm>

注記: URLが正しく機能するためにはAPIキートパラメータが必要です。URLリスエストの例については以下を参照してください。

説明: キーワードの接頭辞に対するタイプアヘッド(先行入力)サジェスションを返します。

パラメーター

注記: パラメーターはすべて大文字小文字を区別します。

名称 必須 / オプション 説明
apiKey 必須

サイトを特定する固有のキーです。弊社のクライアントはそれぞれ固有のAPIキーをお持ちです。これによって他のクライアントのデータやトラフィックと区別します。このキーは弊社からクライアントに提供されます。

例: apiKey=4faeaf752ee40a0f

search 必須

検索ワードの接頭辞です。

リクエスト例

注記: ここではリクエストに対する適切なシンタックスを示すための例にを使って説明します。実際にはapiキーと検索ワードを正しいものに置き換えて使用してください。

GET http://recs.richrelevance.com/rrserver/api/v1/service/typeAhead/f20dc17e1482cd47?search=de

この例のリクエストでは接頭辞「de」で始まる5つの検索ワードのサジェスションが返されます。

レスポンス例

[
 
{ "score": "1", "term": "depth 4-door refrigerator with flexzone&trade", "id": "RF24FSEDBSR/AA", "type": "product" }
 
,
 
{ "score": "5", "term": "depth 4-door flex&trade french door", "id": "RF23J9011SR/AA", "type": "product" }
 
,
 
{ "score": "4", "term": "depth french door refrigerator stainless", "id": "RF18HFENBSR/AA", "type": "product" }
 
,
 
{ "score": "3", "term": "depth side-by-side food showcase refrigerator", "id": "RH22H9010SR/AA", "type": "product" }
 
,
 
{ "score": "2", "term": "depth side-by-side refrigerator stainless steel", "id": "RS22HDHPNSR/AA", "type": "product" }
 
]

ウェブ実装の例

弊社では、お使いの検索ボックスにタイプアヘッド・サジェスションのユーザー・エクスペリエンスを取り入れるために使用できるリファレンス・コード(JavaScript、HTML、CSS)を提供しています。自社のウェブサイトのUXの基本方針やガイドラインに合わせてコードを変更してください。

以下はサジェスションされた検索ワードの抽出方法と商品レコメンデーションの表示方法を示すサンプル・ページです。

<html>
    <head>
    <script src="typeAhead_reference.js"></script>
     
    $(document).ready(function () {
      $('#search-input').sayt({
        inputWidth: '400',
        setInputValueOnSelection: true,
        fadeTime: 0,
        debug: false,
        imageHeight: 80,
        imageWidth: 80,
        removeImageProtocol: true,
        sourceIsInstantSearchBooleanQueryParam: 'fromInstantSearch',
     
        termsUrl: 'http://recs.richrelevance.com/rrserver/api/v1/service/typeAhead/<API_KEY>?search=',
     
        productsUrl: 'http://recs.richrelevance.com/rrserver/api/rrPlatform/recsForPlacements?apiClientKey=<API_CLIENT_KEY>&apiKey=<API_KEY>&placements=search_page.typeAheadSearch_1&jsonp=true&searchTerm=',
        productsJsonpCallbackParameterName: 'jcb'
     
      }).focus();
    });
    </head>
 
    <body>
      <div id="Search_Example" class="container">
        <div class="main-app">
          Instant Search   
          <p/>
          <form action="" class="search-form">
            <input id="search-input" class="search-box" name="q" id="example-box" size="48" placeholder="Search" autocomplete="off">
            <input type="hidden" name="fromInstantSearch" value="false"/>
          </form>
        </div>
      </div>
    </body>
</html>

Download: typeAhead_reference.js

  • Was this article helpful?