pylucene - searcher
많은 어려움 끝에 겨우 설치하고는 테스트 코드 하나 만들어봅니다;;
# -*- coding: utf8 -*-
'''
Created on 2011. 5. 16.
@author: kwangsub
'''
import time
import os
from lucene import *
def search():
initVM(CLASSPATH)
analyzer = StandardAnalyzer(Version.LUCENE_CURRENT)
directory = SimpleFSDirectory(File("/home1/irteam/repository/lucene_index_repo/HEALTH_HOSPITAL_CJK/db"))
searcher = IndexSearcher(directory, True)
t = Term("addr", "서울")
query = TermQuery(t)
topDocs = searcher.search(query, 10)
for doc in topDocs.scoreDocs:
print doc
searcher.close()
directory.close()
if __name__ == '__main__':
search()
'''
Created on 2011. 5. 16.
@author: kwangsub
'''
import time
import os
from lucene import *
def search():
initVM(CLASSPATH)
analyzer = StandardAnalyzer(Version.LUCENE_CURRENT)
directory = SimpleFSDirectory(File("/home1/irteam/repository/lucene_index_repo/HEALTH_HOSPITAL_CJK/db"))
searcher = IndexSearcher(directory, True)
t = Term("addr", "서울")
query = TermQuery(t)
topDocs = searcher.search(query, 10)
for doc in topDocs.scoreDocs:
print doc
searcher.close()
directory.close()
if __name__ == '__main__':
search()
댓글
댓글 쓰기