Skip to content

Instantly share code, notes, and snippets.

@mschoch
mschoch / gist:5181f4a3e2f273c30bd4
Created November 15, 2014 23:10
Custom bleve analyzer for words containing hyphens
func buildIndexMapping() (*bleve.IndexMapping, error) {
indexMapping := bleve.NewIndexMapping()
err = indexMapping.AddCustomTokenizer("words_with_hyphens_tokenizer",
map[string]interface{}{
"regexp": "[0-9A-Za-z_\-]+",
"type": "regexp",
})
if err != nil {
return nil, err
@mschoch
mschoch / gist:b62bf9ca81e1e783ab2a
Created November 18, 2014 20:17
custom mapping to index subwords from compound words
func buildIndexMapping() (*bleve.IndexMapping, error) {
indexMapping := bleve.NewIndexMapping()
var err error
err = indexMapping.AddCustomTokenMap("sv_compound_auto_wordmap",
map[string]interface{}{
"type": `custom`,
"tokens": []interface{}{
`olje`,
`luft`,
@mschoch
mschoch / test.c
Created December 23, 2014 21:50
forestdb crash with iterator on snapshot
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include "libforestdb/forestdb.h"
int main(int argc, char**argv) {
fdb_file_handle *file;
fdb_kvs_handle *kvs, *snapshot;
fdb_status status;
fdb_config config;
@mschoch
mschoch / test.c
Last active August 29, 2015 14:12
forestdb test case
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include "libforestdb/forestdb.h"
int main(int argc, char**argv) {
fdb_file_handle *file;
fdb_kvs_handle *kvs, *snapshot;
fdb_status status;
fdb_config config;
@mschoch
mschoch / test2.c
Last active August 29, 2015 14:12
forestdb fail
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include "libforestdb/forestdb.h"
int main(int argc, char**argv) {
fdb_file_handle *file;
fdb_kvs_handle *kvs, *snapshot;
fdb_status status;
fdb_config config;
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include "libforestdb/forestdb.h"
int main(int argc, char**argv) {
fdb_file_handle *file;
fdb_kvs_handle *kvs, *snapshot;
fdb_status status;
fdb_config config;
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include "libforestdb/forestdb.h"
int main(int argc, char**argv) {
fdb_file_handle *file;
fdb_kvs_handle *kvs, *snapshot;
fdb_status status;
fdb_config config;
mschoch@gamer:~/go/src/github.com/blevesearch/bleve/index/upside_down$ go test -v -test.run=XXX -test.bench=BenchmarkNullIndexing1Workers100Batch -tags 'leveldb forestdb' -test.cpu=1 -test.cpuprofile=nullindex100.profile
PASS
BenchmarkNullIndexing1Workers100Batch 10 118690503 ns/op
ok github.com/blevesearch/bleve/index/upside_down 1.314s
mschoch@gamer:~/go/src/github.com/blevesearch/bleve/index/upside_down$ go tool pprof upside_down.test nullindex100.profile
Entering interactive mode (type "help" for commands)
(pprof) top25
1150ms of 1310ms total (87.79%)
Showing top 25 nodes out of 87 (cum >= 20ms)
flat flat% sum% cum cum%
mschoch@gamer:~/go/src/github.com/blevesearch/bleve/index/upside_down$ go tool pprof upside_down.test nullindex100.profile
Entering interactive mode (type "help" for commands)
(pprof) top25
1280ms of 1350ms total (94.81%)
Showing top 25 nodes out of 62 (cum >= 10ms)
flat flat% sum% cum cum%
200ms 14.81% 14.81% 340ms 25.19% unicode.Is
150ms 11.11% 25.93% 150ms 11.11% scanblock
140ms 10.37% 36.30% 140ms 10.37% unicode.is16
130ms 9.63% 45.93% 130ms 9.63% github.com/blevesearch/segment.in
mschoch@gamer:~/go/src/github.com/blevesearch/bleve/index/upside_down$ go test -v -test.run=XXX -test.bench=BenchmarkNullIndexing1Workers100Batch -tags 'leveldb forestdb' -test.cpu=1 -test.cpuprofile=nullindex100.profile
PASS
BenchmarkNullIndexing1Workers100Batch 10 101808166 ns/op
ok github.com/blevesearch/bleve/index/upside_down 1.129s
mschoch@gamer:~/go/src/github.com/blevesearch/bleve/index/upside_down$ go tool pprof upside_down.test nullindex100.profile
Entering interactive mode (type "help" for commands)
(pprof) top25
990ms of 1120ms total (88.39%)
Showing top 25 nodes out of 67 (cum >= 20ms)
flat flat% sum% cum cum%