English 中文(简体)
谷歌搜索器自动检索系统
原标题:Google Custom Search API Autocomplete?

我们再次使用权宜搜索器(服务机方APIC)来控制我们的搜索结果。

我愿在搜查中添加一个汽车特征——然而,任何人都不知道是否对此表示支持(无论是通过服务器机载体还是某种客户方JSONP?)

我曾尝试利用自动设备进行谷歌定制的搜索,但这似乎想要利用搜索箱和展示果树,我不想这样做。

最佳回答

争取这样的工作——希望有助于其他人:

$(function () {
  $( input.search )
    .focus(function () { this.select(); })
    .mouseup(function (e) { e.preventDefault(); })
    .autocomplete({
      position: {
        my: "left top",
        at: "left bottom",
        offset: "0, 5",
        collision: "none"
      },
      source: function (request, response) {
        $.ajax({
          url: "http://clients1.google.com/complete/search?q=" + request.term + "&hl=en&client=partner&source=gcsc&partnerid={GOOGLESEARCHID}&ds=cse&nocache=" + Math.random().toString(),
          dataType: "jsonp",
          success: function (data) {
            response($.map(data[1], function (item) {
              return {
                label: item[0],
                value: item[0]
              };
            }));
          }
        });
      },
      autoFill: true,
      minChars: 0,
      select: function (event, ui) {
        $(this).closest( input ).val(ui.item.value);
        $(this).closest( form ).trigger( submit );
      }
    });
});
问题回答

在撰写本报告时(2013年6月),在取得XML成果的同时,实现自动化的途径也比较容易:

<gcse:searchbox-only enableAutoComplete="true" resultsUrl="#"></gcse:searchbox-only>

  • The "trick" is that you can specify "resultsUrl" which means you can direct the actual search results to a page you generate via the XML API, without having to implement the search box UX yourself.




相关问题
high load on mysql DB how to avoid?

I have a table contain the city around the worlds it contain more than 70,000 cities. and also have auto suggest input in my home page - which used intensively in my home page-, that make a sql query ...

Fast Javascript String Replacement

Hey there geniuses of SO! This is for an autocomplete plugin that needs to accept data as an array of arrays and convert it using a format string (or regex). The format string could be any format. ...

Categorized results – jQuery autocomplete plugin

I m looking for an autocomplete plugin that makes it easy to categorize search results. If that s unclear, take a look at Apple.com s search bar (top right). I know that script.aculo.us autocomplete ...

Limiting IntelliJ IDEA import suggestions on completion

When I type the name of a class which will need to be imported, IntelliJ lovingly pops up with a list of suggestions. However, most of the time those suggestions are things I d never want to import, ...

热门标签