2016-10-12 3 views
0

내 맞춤 검색 엔진 (cse)의 검색 결과를 하루로 제한하고 싶습니다. google cse 맞춤 검색 날짜 제한

나는 또한 https://developers.google.com/apis-explorer/#p/customsearch/v1/search.cse.list

어떻게 내가 검색 옵션이 매개 변수를 전달할 수있는 API를 탐색기에서 사용할 수 있습니다 여기 https://developers.google.com/custom-search/json-api/v1/reference/cse/list

는 "dateRestrict"매개 변수에 대한 몇 가지 정보를 찾았나요? .... 나는 그것이 아무 소용 제외한 작동 할 수 있습니다 생각 어디든지 나는

내가 비슷한 질문이 이미 발견 ... 넣어려고 노력했지만 대답은 단지 다른 API로 전환했다

<script type='text/javascript'> 
    google.load('search', '1', {language: 'de', style: google.loader.themes.V2_DEFAULT}); 
    google.setOnLoadCallback(function() { 
     var customSearchOptions = {}; 
     customSearchOptions[google.search.Search.RESTRICT_EXTENDED_ARGS] ={'as_sitesearch' : 'https://xy.com/'}; 
     var orderByOptions = {}; 
     orderByOptions['keys'] = [{label: 'Relevanz', key: ''} , {label: 'Datum', key: 'date'}]; 
     customSearchOptions['enableOrderBy'] = true; 
     customSearchOptions['orderByOptions'] = orderByOptions; 
     var customSearchControl = new google.search.CustomSearchControl('mykeygoeshere', customSearchOptions); 
     customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET); 
     customSearchControl.setLinkTarget(google.search.Search.LINK_TARGET_SELF); 
     var options = new google.search.DrawOptions(); 
     var query = unescape(LTH.getUrlVars().searchfor); 
     customSearchControl.draw('cse', options);   
     customSearchControl.execute(query);      
    }, true); 
    </script>**strong text** 

답변

0

cse에 전달 된 인수에 대한 옵션을 customSearchOptions에 지정할 수 있습니다.

https://developers.google.com/custom-search/docs/xml_results#WebSearch_Query_Parameter_Definitions

https://developers.google.com/custom-search/docs/js/cselement-reference#opt_options

그래서이 마침내

customSearchOptions[google.search.Search.RESTRICT_EXTENDED_ARGS] ={'as_sitesearch' : 'https://www.landestheater-linz.at/','as_qdr':'d100'}; 
근무 내가 전에이 시도하지만 매개 변수 이름은 XML-API보다 다른 (덕분에 구글)
관련 문제