This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#full details now available: http://tiredblogger.wordpress.com/2011/12/28/finding-todos-and-reporting-in-powershell/ | |
param( | |
#this is appalling; there has to be a better way to get the raw name of "this" directory. | |
[string]$DirectoryMask = (get-location), | |
[array]$Include = | |
@("*.spark","*.cs","*.js","*.coffee","*.rb"), | |
[array]$Exclude = | |
@("fubu-content","packages","build","release"), | |
[switch]$Html, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import wraps | |
def memoise(wrapped): | |
cache = {} | |
@wraps(wrapped) | |
def wrapper(*args, **kwargs): | |
key = (args, tuple(sorted(kwargs.items()))) | |
if key not in cache: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Here are the contents of the synonym file that is located here: analysis/synonym_test.txt | |
test1, a+b | |
test2, b+c | |
test3, d/c | |
work, business | |
# Create the index | |
curl -XPOST localhost:9200/es-syntest -d '{ | |
"settings" : { | |
"number_of_shards" : 1, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Index | |
--------------------------------------------------------------------- | |
curl -XPUT http://localhost:9200/pictures/ -d ' | |
{ | |
"settings": { | |
"analysis": { | |
"analyzer": { | |
"index_analyzer": { | |
"tokenizer": "standard", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# First, create the synonyms file /opt/elasticsearch/name_synonyms.txt | |
# with the contents: | |
# | |
# rob,bob => robert | |
# | |
## CREATE THE INDEX WITH ANALYZERS AND MAPPINGS | |
curl -XPUT 'http://127.0.0.1:9200/test/?pretty=1' -d ' | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# TO_FOLDER=/something | |
# FROM=/your-es-installation | |
DATE=`date +%Y-%m-%d_%H-%M` | |
TO=$TO_FOLDER/$DATE/ | |
echo "rsync from $FROM to $TO" | |
# the first times rsync can take a bit long - do not disable flusing | |
rsync -a $FROM $TO | |
# now disable flushing and do one manual flushing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# (Re)create the index | |
curl -X DELETE "http://localhost:9200/tagcloud" | |
curl -X PUT "http://localhost:9200/tagcloud"-d '{ | |
"settings" : { | |
"index" : { | |
"number_of_shards" : 1, | |
"number_of_replicas" : 0 | |
} | |
} | |
}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -XPUT localhost:9200/local -d '{ | |
"settings" : { | |
"analysis" : { | |
"analyzer" : { | |
"stem" : { | |
"tokenizer" : "standard", | |
"filter" : ["standard", "lowercase", "stop", "porter_stem"] | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# curl -XDELETE http://localhost:9200/test-index | |
# "analyzer"."default" => default name for index and search | |
# "tokenizer" : "standard" => splits words at punctuation characters | |
# http://www.elasticsearch.org/guide/reference/index-modules/analysis/ | |
curl -XPUT http://localhost:9200/test-index/ -d ' | |
{ | |
"index": { | |
"analysis": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -XPUT http://localhost:9200/test_index/ -d ' | |
{ | |
"index": { | |
"analysis": { | |
"analyzer": { | |
"index_analyzer": { | |
"tokenizer": "nGram", | |
"filter": ["lowercase", "snowball"] | |
}, |