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
import redis | |
import json | |
import time | |
import datetime | |
import uuid | |
import threading | |
import argparse | |
def provider(conn, name, total_tasks, queue, sleep=0.1): | |
""" Provider """ |
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
import binascii | |
import random | |
TOTAL_ELEMENTS = 2000 | |
SHARD_SIZE = 512 | |
def shard_key(base, key, total_elements, shard_size): | |
""" | |
シャードキーを計算する関数 | |
「Redis入門」リスト9-7 から引用 |
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
package higlighter; | |
import java.io.File; | |
import org.apache.lucene.analysis.Analyzer; | |
import org.apache.lucene.analysis.core.WhitespaceAnalyzer; | |
import org.apache.lucene.document.Document; | |
import org.apache.lucene.index.DirectoryReader; | |
import org.apache.lucene.index.IndexReader; | |
import org.apache.lucene.queryparser.classic.QueryParser; |
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
package indexer; | |
import java.io.File; | |
import java.io.IOException; | |
import java.util.HashMap; | |
import java.util.Map; | |
import org.apache.lucene.analysis.core.WhitespaceAnalyzer; | |
import org.apache.lucene.document.Document; | |
import org.apache.lucene.document.Field.Store; |
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
import time | |
from fst import * | |
from struct import pack | |
def build_dict(enc, outfile, *files): | |
entries = {} | |
for file in files: | |
with open(file, encoding=enc) as f: | |
for line in f: | |
line = line.rstrip() |
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
import org.apache.lucene.analysis.Analyzer; | |
import org.apache.lucene.analysis.TokenStream; | |
import org.apache.lucene.analysis.ja.JapaneseAnalyzer; | |
import org.apache.lucene.analysis.ja.JapaneseTokenizer; | |
import org.apache.lucene.analysis.ja.tokenattributes.PartOfSpeechAttribute; | |
import org.apache.lucene.analysis.ja.tokenattributes.ReadingAttribute; | |
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute; | |
import org.apache.lucene.analysis.tokenattributes.OffsetAttribute; | |
import org.apache.lucene.analysis.util.CharArraySet; |
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
package indexer; | |
import java.io.File; | |
import java.io.IOException; | |
import java.lang.reflect.Constructor; | |
import java.util.Date; | |
import org.apache.lucene.analysis.Analyzer; | |
import org.apache.lucene.document.Document; | |
import org.apache.lucene.index.IndexWriter; |
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
package searcher; | |
import java.io.File; | |
import java.io.IOException; | |
import java.lang.reflect.Constructor; | |
import org.apache.lucene.analysis.Analyzer; | |
import org.apache.lucene.document.Document; | |
import org.apache.lucene.index.IndexReader; | |
import org.apache.lucene.search.IndexSearcher; |
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
package test.solrbook; | |
import java.io.BufferedReader; | |
import java.io.File; | |
import java.io.FileInputStream; | |
import java.io.FileReader; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.Reader; | |
import java.io.StringReader; |
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
** Solr4.0-ALPHAでハマったのでメモ ** | |
schema.xmlに"_version_" という名のフィールドがないと、deleteByQueryがスルーされるというバグを踏んでいたらしい。 | |
https://issues.apache.org/jira/browse/SOLR-3432 | |
ドキュメントを全削除しようとして、 | |
$ curl http://localhost:8983/solr/update?commit=true -H "Content-type: text/xml" --data-binary '<delete><query>*:*</query></delete>' | |
をいくら実行しても、まったく削除されないので困って検索したら、ヒットしたのが上記Issue。 |
OlderNewer