Skip to content

Commit

Permalink
Update build script + js.
Browse files Browse the repository at this point in the history
Both need to know about the index name changes.
  • Loading branch information
markstory committed May 19, 2012
1 parent ef5c870 commit 82e5016
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion scripts/populate_search_index.php
Expand Up @@ -8,6 +8,7 @@
// Elastic search config
define('ES_URL', 'http://localhost:9200');
define('ES_INDEX', 'documentation');
define('CAKEPHP_VERSION', '1-1');


function main($argv) {
Expand Down Expand Up @@ -37,7 +38,7 @@ function updateIndex($lang, $file) {
$id = str_replace('/', '-', $id);
$id = trim($id, '-');

$url = implode('/', array(ES_URL, ES_INDEX, $lang, $id));
$url = implode('/', array(ES_URL, ES_INDEX, CAKEPHP_VERSION . '-' . $lang, $id));

$data = array(
'contents' => $fileData['contents'],
Expand Down
13 changes: 8 additions & 5 deletions themes/cakephp/static/app.js
Expand Up @@ -3,6 +3,10 @@ if (/cakephp\.org/.test(document.domain)) {
}

App = {};
App.config = {
url: 'http://search.cakephp.org/search',
version: '1-1'
};

App.Book = (function() {

Expand Down Expand Up @@ -49,7 +53,7 @@ App.Book = (function() {

return {
init : init
}
};
})();

// Inline search form, and standalone search form.
Expand All @@ -60,7 +64,6 @@ App.InlineSearch = (function () {
var searchResults;
var searchInput;
var doSearch;
var searchUrl = 'http://search.cakephp.org/search';

var delay = (function(){
var timer;
Expand Down Expand Up @@ -112,11 +115,11 @@ App.InlineSearch = (function () {
};

var executeSearch = function (value, searchResults, limit, page) {
var query = {lang: window.lang, q: value};
var query = {lang: window.lang, q: value, version: App.config.version};
if (page) {
query.page = page;
}
var url = searchUrl + '?' + jQuery.param(query);
var url = App.config.url + '?' + jQuery.param(query);
var xhr = $.ajax({
url: url,
dataType: 'json',
Expand Down Expand Up @@ -161,7 +164,7 @@ App.InlineSearch = (function () {
return {
init: init,
delay: delay,
searchUrl: searchUrl,
searchUrl: App.config.url,
createSearch: createSearch,
executeSearch: executeSearch
};
Expand Down

0 comments on commit 82e5016

Please sign in to comment.