Skip to content

Instantly share code, notes, and snippets.

View johtani's full-sized avatar

Jun Ohtani johtani

View GitHub Profile
@johtani
johtani / list.orma.json.gohtml
Last active December 12, 2023 09:22
ブログ記事のOrama検索実装の紹介用Gist
{{/* Generates an array of blog contents for indexing orama */}}
{{- $.Scratch.Add "item" slice -}}
{{- $section := $.Site.GetPage "section" .Section }}
{{- range .Site.AllPages -}}
{{- if or (and (.IsDescendant $section) (and (not .Draft) (not .Params.private))) $section.IsHome -}}
{{- if (and (eq .Section "post") .File) -}}
{{- if .Params.Tags -}}
{{- $.Scratch.Add "item" (dict "id" .File.UniqueID "date" .Date.UTC.Unix "dir" .File.Dir "lang" .Lang "lastmod" .Lastmod.UTC.Unix "permalink" .Permalink "publishdate" .PublishDate "title" .Title "tags" .Params.Tags "summary" .Summary "contents" .Plain)}}
{{- else -}}
{{- $.Scratch.Add "item" (dict "id" .File.UniqueID "date" .Date.UTC.Unix "dir" .File.Dir "lang" .Lang "lastmod" .Lastmod.UTC.Unix "permalink" .Permalink "publishdate" .PublishDate "title" .Title "summary" .Summary "contents" .Plain)}}
@johtani
johtani / sample.json
Created July 20, 2020 04:17
joinで子供をハイライト
PUT join_highlight
{
"mappings": {
"properties": {
"my_id": {
"type": "keyword"
},
"my_join_field": {
"type": "join",
"relations": {
@johtani
johtani / demo.json
Created June 18, 2020 15:37
Elasticsearch勉強会のデモで利用したDevConsoleのスクリプト
## version 7.9で動作するはずです。 discard_compound_tokenの設定は7.8までは動作しないです(それ以外については動作します。)
DELETE en_synonym_test
PUT en_synonym_test
{
"settings": {
"analysis": {
"analyzer": {
"en_synonym": {
@johtani
johtani / words.txt
Last active June 12, 2020 14:56
UniDicに出てくる、Kuromojiが区切り文字と判断する文字が含まれる単語たち
start with punctuation: [606]. one char is [384]
all punctuations: [111]
hasPunctuations: [1780]
+++++++++++++++++ Start with Punctuation +++++++++++++++++++++
¡
¢
£
¤
¦
§
@johtani
johtani / gist:50aa2776a385c5c8dfa3a0d1e4e268cd
Last active June 12, 2020 14:42
ipadicに出てくる、Kuromojiが区切り文字と判断する文字が含まれる単語の一覧
start with punctuation: [101]. one char is [97]
all punctuations: [3]
hasPunctuations: [723]
+++++++++++++++++ Start with Punctuation +++++++++++++++++++++
@johtani
johtani / 1_辞書の更新方法_ファイル編.json
Last active April 27, 2020 03:37
「辞書の更新についての注意事項」ブログの補足手順など
## 0. インデックスの準備
### 再現可能なようにまず削除
DELETE file_dic_sample
### 辞書ファイルの用意
ファイル名 : custom_dic.txt
配置場所 : ES_PATH_CONF/analyzer/custom_dic.txt
内容
```
@johtani
johtani / .zshrc
Created December 17, 2019 07:09
dot_zshrc_20191217
## For rewrite prezto default settings
EDITOR=vim
VISUAL=vim
### aliases
alias ls='ls -aG'
alias vscode='open -a ~/Applications/Visual\ Studio\ Code.app '
### For ant
export ANT_OPTS=-Dfile.encoding=UTF-8
@johtani
johtani / build.xml
Created October 16, 2019 15:11
ant build-dict with unidic
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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
@johtani
johtani / gist:b53e9e241e5b98519fb3ffe12b4164eb
Created October 16, 2019 14:49
ant build-dict with ipadic
~/IdeaProjects/lucene-gosen-workspace/lucene-solr/lucene/analysis/kuromoji (fix-4056 *$) $ ant clean
Buildfile: /Users/johtani/IdeaProjects/lucene-gosen-workspace/lucene-solr/lucene/analysis/kuromoji/build.xml
clean:
[delete] Deleting directory /Users/johtani/IdeaProjects/lucene-gosen-workspace/lucene-solr/lucene/build/analysis/kuromoji
BUILD SUCCESSFUL
Total time: 0 seconds
~/IdeaProjects/lucene-gosen-workspace/lucene-solr/lucene/analysis/kuromoji (fix-4056 *$) $ ant build-dict
Buildfile: /Users/johtani/IdeaProjects/lucene-gosen-workspace/lucene-solr/lucene/analysis/kuromoji/build.xml
@johtani
johtani / gist:310672675aec7d2a9ed8516bf0ae3558
Created April 27, 2018 08:29
reindex with index template in v6.2.4
PUT _template/hoge
{
"index_patterns": ["hoge-*"],
"settings": {
"number_of_replicas": 0,
"number_of_shards": 2
},
"mappings": {
"type1": {