__author__ = 'Hiromichi Matsushima <hylom@users.osdn.net>'
__version__ = "0.1.0"
-from wrapper import init_vm, Indexer, Searcher, Document, Query, QueryParseError
+from wrapper import init_vm, Indexer, Searcher, Document, Query, QueryParseError, TermQuery
__all__ = []
import lucene
from java.io import File
from org.apache.lucene.util import Version
-from org.apache.lucene.index import IndexWriter, IndexWriterConfig, IndexReader
-from org.apache.lucene.search import IndexSearcher
+from org.apache.lucene.index import IndexWriter, IndexWriterConfig, IndexReader, Term
+from org.apache.lucene.search import IndexSearcher, TermQuery as _TermQuery
from org.apache.lucene.analysis.ja import JapaneseAnalyzer, JapaneseTokenizer
from org.apache.lucene.store import SimpleFSDirectory
from org.apache.lucene.document import Document as LuceneDocument, Field, TextField, StringField, IntField
docs = self._searcher.search(query.query, max_result)
return SearchResults(docs, self._searcher)
+ def raw_search(self, query, max_result=1000):
+ docs = self._searcher.search(query, max_result)
+ return SearchResults(docs, self._searcher)
+
class SearchResults(LuceneWrapper):
def __init__(self, docs, searcher):
return val
+class TermQuery(LuceneWrapper):
+ def __init__(self, field_name, query_term):
+ super(TermQuery, self).__init__()
+
+ term = Term(field_name, query_term)
+ self.query = _TermQuery(term)
+
+
class Query(LuceneWrapper):
def __init__(self, field_name, query_text):
super(Query, self).__init__()