2013-07-25 2 views
1

https://developers.google.com/custom-search/docs/queries에 구조를 사용하려고했지만 성공적으로 업로드 할 수 없습니다.Google 맞춤 검색 Autocomplete에서 XML을 만드는 방법은 무엇입니까?

<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를 사용하고 있습니다. 게시물의 제목을 얻었고 Google 맞춤 검색을위한 문자열 쿼리로 사용하고 싶습니다.

날 자동 완성을 위해 XML을 생성하는 방법을 알아내는 데 도움이 바랍니다.

답변

1

설명 속성이 마음에 들지 않습니다. 그것들을 제거하면 효과가 있습니다.

0

그런 XML에서 모든 용어를 남겨 :

<Autocompletion term="%term-title%" type="%type%" language=""/> 

이 기간의 길이에주의, 나는 3 개 이하 단어의 경우, 구글은 잘 그것을 받아 들일 것이라는 점을 발견했다. 또한 추가하는 항목 수에 큰 제한이 없습니다 (한 번에 9000 개의 항목 추가). 그리고 저는 그것들을 러시아어로 추가 했으므로, 인코딩에 문제가 없습니다.

최종 형식은 것과 같아야합니다 :

<Autocompletions> 
    <Autocompletion term="%term-title%" type="%type%" language=""/> 

    ... 

    <Autocompletion term="%term-title%" type="%type%" language=""/> 
</Autocompletions> 

는 정말 잘 구글 문서화하지, 그래서 당신은이 글을 읽는 시간을 낭비해야합니다. 희망이 도움 :

관련 문제