Search 如何在Google自定义搜索自动完成中创建XML?
我尝试在上使用该结构,但无法成功上载Search 如何在Google自定义搜索自动完成中创建XML?,search,google-custom-search,Search,Google Custom Search,我尝试在上使用该结构,但无法成功上载 <Autocompletions> <Autocompletion term="cake" type="1" language=""/> <Autocompletion term="strawberry.*" type="2" match="2" language=""/> <Autocompletion term="vanilla" type="2" language=""/> <Aut
<Autocompletions>
<Autocompletion term="cake" type="1" language=""/>
<Autocompletion term="strawberry.*" type="2" match="2" language=""/>
<Autocompletion term="vanilla" type="2" language=""/>
<Autocompletion term="apple" type="3" language="">
<Promotion id="1" queries="dessert" title="Apple pie for dessert!" url="http://www.example.com/applepieforsale"
start_date="" end_date="" image_url="" description="Apple pie is the best dessert ever!"/>
<Promotion id="2" queries="apple" title="Buy Apple pie" url="http://www.example.com/applepieforsale"
start_date="" end_date="" image_url="" description="We stock the best apple pie in the world, right here."/>
</Autocompletion>
</Autocompletions>
我的网站正在使用wordpress;我得到了帖子的标题,想用它作为谷歌自定义搜索的字符串查询
请帮助我找出如何创建用于自动完成的XML。它不喜欢描述属性。如果您删除了这些,它就会工作。将所有术语保留为XML格式,如下所示:
<Autocompletion term="%term-title%" type="%type%" language=""/>
<Autocompletions>
<Autocompletion term="%term-title%" type="%type%" language=""/>
...
<Autocompletion term="%term-title%" type="%type%" language=""/>
</Autocompletions>
注意术语的长度,我发现如果是3个或更少的单词,谷歌会接受它。您添加的条目数量也没有太大限制(我一次添加了9000条条目)。我用俄语添加了它们,所以编码也没有问题
最终格式应如下所示:
<Autocompletion term="%term-title%" type="%type%" language=""/>
<Autocompletions>
<Autocompletion term="%term-title%" type="%type%" language=""/>
...
<Autocompletion term="%term-title%" type="%type%" language=""/>
</Autocompletions>
...
谷歌没有很好的文档记录,所以你不得不浪费时间阅读。希望有帮助:)