Skip to content

Instantly share code, notes, and snippets.

View vhyza's full-sized avatar

Vojtěch Hýža vhyza

View GitHub Profile
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = "carrierwave-blob"
s.version = "0.0.1"
s.platform = Gem::Platform::RUBY
s.summary = "BLOB support for Carrierwave"
s.authors = [ 'Karel Minarik', 'Vojtech Hyza' ]
s.email = [ 'karmi@karmi.cz', 'vhyza@vhyza.eu' ]
.DS_Store
# ========================================
# Testing multiple analyzers per field
# ========================================
# Setup
curl -s -X DELETE 'http://localhost:9200/news_test/'
# Create index with settings and mapping
curl -s -X PUT 'http://localhost:9200/news_test' -d '
{
@vhyza
vhyza / es_fields_test.sh
Created June 10, 2011 10:16
Elasticsearch fields test
# Remove index
curl -s -XDELETE "http://localhost:9200/fields_test"
# Set new index with mapping
curl -s -XPUT "http://localhost:9200/fields_test" -d '
{
"mappings": {
"tweet" : {
"properties" : {
@vhyza
vhyza / catch_exception.rb
Created November 10, 2011 10:53
Removed require 'cgi' to avoid segmentation fault
# encoding: utf-8
STDOUT.sync = true
STDERR.sync = true
require 'pathname'
at_exit do
if (e = $!) && !e.instance_of?(SystemExit)
require "#{ENV['TM_SUPPORT_PATH']}/lib/escape"
@vhyza
vhyza / filtered.rb
Created December 20, 2011 14:47
Tire filtered query test
require 'tire'
Tire.configure do
logger STDERR
end
Tire.index 'filtered_test' do
delete
create
store tags: ['ruby'], content: 'is awesome'
@vhyza
vhyza / tire_228.rb
Created February 6, 2012 12:19
Tire issue #228
require 'tire'
Tire.index 'users_tire_issue' do
delete
create mappings: {
user: {
properties: {
email: { type: 'string' },
names: { type: 'string', analyzer: 'snowball' },
medical_conditions: {
@vhyza
vhyza / es-czech-analyzer.rb
Created May 21, 2012 10:40
Elasticsearch czech analyzer test
require 'rubygems'
require 'tire'
class Article
include Tire::Model::Persistence
# Jen zmena nazvu indexu at nahodou nesmazes nejaky svuj existujici 'articles' index
#
@vhyza
vhyza / elasticsearch_mapping.sh
Created January 25, 2011 18:04
searching in multiple languages using different analyzers
# Setup
curl -s -X DELETE 'http://localhost:9200/news_cs/'
curl -s -X DELETE 'http://localhost:9200/news_en/'
# Create Czech and English indices (databases)
curl -s -X PUT 'http://localhost:9200/news_cs/'
curl -s -X PUT 'http://localhost:9200/news_en/'
# Create mapping for Czech documents
curl -s -X PUT 'http://localhost:9200/news_cs/_mapping' -d '
@vhyza
vhyza / .gitignore
Created January 22, 2013 11:11 — forked from karmi/.gitignore
.DS_Store
Gemfile.lock
*.pem
node.json
tmp/*
!tmp/.gitignore