This file contains 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
-- data http://www.vinmonopolet.no/api/produkter | |
-- beskrivelse http://vertical.vinmonopolet.no/vmp/om-vinmonopolet/datadeling/_attachment/434521?_ts=1468fb68128 | |
-- prepare the downloaded data by replacing Norwegian numeric separator , with . (using this regex:(\d),(\d) replace:\1.\2 | |
-- In my csv file there was a lonely double quote, that had to be manually deleted | |
--DROP DATABASE "vinmonopolet"; | |
CREATE DATABASE "vinmonopolet"; | |
\connect vinmonopolet postgres |
This file contains 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
text: This text will be used if nothing else is specified. | |
analyzer: | |
myAnalyzer: | |
type: custom | |
tokenizer: whitespace | |
filter: | |
- lowercase | |
- reverse |
This file contains 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 -XPOST "http://localhost:9200/seasonalfoods/_search" -d' | |
{ "explain":true, | |
"query": { | |
"terms": { | |
"ingredients": [ | |
"jordbær", | |
"bringebær", | |
"rips", | |
"solbær", | |
"stikkelsbær", |
This file contains 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 -XPOST "http://localhost:9200/seasonalfoods/_search" -d' | |
{ | |
"size": 0, | |
"aggs": { | |
"ingredients": { | |
"filter": { "terms": { | |
"ingredients": [ | |
"jordbær", | |
"rips", |
This file contains 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
text: This text will be used if nothing else is specified. | |
analyzer: | |
myAnalyzer: | |
type: custom | |
tokenizer: whitespace | |
filter: | |
- lowercase | |
- reverse |
This file contains 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
#!/bin/bash | |
export ELASTICSEARCH_ENDPOINT="http://localhost:9200" | |
# Create indexes | |
curl -XPUT "$ELASTICSEARCH_ENDPOINT/play" -d '{ | |
"settings": { | |
"analysis": { | |
"analyzer": { |
This file contains 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
param ([Parameter(Mandatory=$true)][string]$query) | |
$con = New-Object -TypeName System.Data.OleDb.OleDbConnection | |
$con.ConnectionString = "Provider=Search.CollatorDSO;Extended Properties='Application=Windows';" | |
$con.Open() | |
$cmd = $con.CreateCommand() | |
$query = "SELECT Top 5 System.ItemPathDisplay FROM SYSTEMINDEX WHERE contains(*, '$($query)*') AND System.Kind = 'email'" | |
$cmd.CommandText = $query | |
$rdr = $cmd.ExecuteReader() | |
while ($rdr.Read()) { |
This file contains 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 -XGET "http://localhost:9200/seasonalfoods/_search/template" -d' | |
{ | |
"template": { | |
"query": { | |
"match": { | |
"ingredients": "{{ingredientsParam}}" | |
} | |
} | |
}, | |
"params": { |
NewerOlder