These are field notes gathered during installation of website search facility for the ElasticSearch website.
You may re-use it to put a similar system in place.
The following assumes:
| <?php | |
| // http://www.elasticsearch.com/docs/elasticsearch/rest_api/ | |
| class ElasticSearch { | |
| public $index; | |
| function __construct($server = 'http://localhost:9200'){ | |
| $this->server = $server; | |
| } |
| <?php | |
| /* | |
| * Postcode validation function | |
| * Based on code by John Gardner: http://www.braemoor.co.uk/software/postcodes.shtml | |
| * Converted to use PCRE rather than the now deprecated POSIX regular expressions by | |
| * David Evans. | |
| * | |
| * Optional second argument is set to the properly capitalised and spaced version of | |
| * the postcode. |
| #! /usr/bin/env bash | |
| #clone the repo | |
| git clone -q "${1}" "clones/${2}" | |
| cd "clones/${2}" | |
| #update the submodules (how do we handle errors here?) | |
| git submodule --quiet update --init --recursive |
| Ti.include('overrideTabs.js'); | |
| /* | |
| This is a typical new project -- a tab group with three tabs. | |
| */ | |
| var tabGroup = Ti.UI.createTabGroup(); | |
| /* | |
| Tab 1. |
| // testend on iOS | |
| /* | |
| Copyright 2011 Pedro Enrique | |
| Licensed under the Apache License, Version 2.0 (the "License"); | |
| you may not use this file except in compliance with the License. | |
| You may obtain a copy of the License at | |
These are field notes gathered during installation of website search facility for the ElasticSearch website.
You may re-use it to put a similar system in place.
The following assumes:
| # Grab the protocol being used | |
| RewriteCond %{HTTPS} =on | |
| RewriteRule ^(.+)$ - [env=ps:https] | |
| RewriteCond %{HTTPS} !=on | |
| RewriteRule ^(.+)$ - [env=ps:http] | |
| # Force WWW | |
| RewriteCond %{HTTP_HOST} !^www\. |
| # Run me with: | |
| # | |
| # $ nginx -p /path/to/this/file/ -c nginx.conf | |
| # | |
| # All requests are then routed to authenticated user's index, so | |
| # | |
| # GET http://user:password@localhost:8080/_search?q=* | |
| # | |
| # is rewritten to: | |
| # |
| # | |
| # Wide-open CORS config for nginx | |
| # | |
| location / { | |
| if ($request_method = 'OPTIONS') { | |
| add_header 'Access-Control-Allow-Origin' '*'; | |
| # |
| cd ~ | |
| sudo yum update | |
| sudo yum install java-1.7.0-openjdk.i686 -y | |
| wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.9.tar.gz -O elasticsearch.tar.gz | |
| tar -xf elasticsearch.tar.gz | |
| rm elasticsearch.tar.gz | |
| mv elasticsearch-* elasticsearch | |
| sudo mv elasticsearch /usr/local/share |