Search suggestion API requests make up a substantial portion of our total apache...
[lhc/web/wiklou.git] / includes / api / ApiOpenSearch.php
index 606005c..567f36b 100644 (file)
@@ -42,7 +42,7 @@ class ApiOpenSearch extends ApiBase {
        }
 
        public function execute() {
-               global $wgEnableOpenSearchSuggest;
+               global $wgEnableOpenSearchSuggest, $wgSearchSuggestCacheExpiry;
                $params = $this->extractRequestParams();
                $search = $params['search'];
                $limit = $params['limit'];
@@ -55,7 +55,8 @@ class ApiOpenSearch extends ApiBase {
                else {
                        // Open search results may be stored for a very long
                        // time
-                       $this->getMain()->setCacheMaxAge( 1200 );
+                       $this->getMain()->setCacheMaxAge( $wgSearchSuggestCacheExpiry );
+                       $this->getMain()->setCacheControl( array( 'must-revalidate' => false ) );
 
                        $srchres = PrefixSearch::titleSearch( $search, $limit,
                                $namespaces );