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。 |
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
#-*- coding: utf-8 -*- | |
ENCODINGS = ["utf-8", "sjis"] | |
CHARSET = {"utf-8": "UTF-8", "sjis": "Shift_JIS"} | |
class EncodingHandlerMiddleware(object): | |
def __init__(self, app): | |
self.app = app | |
def __call__(self, env, start_response): |
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
## memcached, Couchbase 両方で使用 | |
import pylibmc | |
import md5 | |
import time | |
host = 'host:port' | |
mc = pylibmc.Client([host]) | |
ITEM_COUNT = 1000000 |
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
## memcached, Couchbaseで使用 | |
import sys | |
import pylibmc | |
import md5 | |
import time | |
import random | |
host = 'host:port' | |
mc = pylibmc.Client([host]) |
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
## memcached, Couchbase 両方で使用 | |
import pylibmc | |
import md5 | |
import time | |
import random | |
import datetime | |
import threading | |
host = 'host:port' |
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
/** | |
* 以下は、Apache Softoware Licence v2.0 の元にで頒布されているコードに一部改変を加えたものです。 | |
* http://www.apache.org/licenses/LICENSE-2.0.txt | |
*/ | |
import static org.junit.Assert.*; | |
import java.io.IOException; | |
import org.apache.lucene.analysis.core.WhitespaceAnalyzer; | |
import org.apache.lucene.document.Document; |
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
public class LockTest { | |
public static void main(String[] args) { | |
try { | |
MyIndexer i1 = new MyIndexer("data"); | |
i1.start(); | |
MyIndexer i2 = new MyIndexer("data"); | |
i2.start(); | |
Thread.sleep(60000); |
OlderNewer