def lazyImport(): global imported if imported: return imported = True VM = getJVM() from java.lang import Long from java.io import File from org.apache.lucene.document import Document, StringField, Field, LongField, IntField from org.apache.lucene.search import IndexSearcher, TermQuery, BooleanQuery, NumericRangeQuery, MatchAllDocsQuery from org.apache.lucene.search import BooleanClause, TotalHitCountCollector, Sort, SortField from org.apache.lucene.index import DirectoryReader, Term, IndexWriter, IndexWriterConfig from org.apache.lucene.store import FSDirectory from org.apache.lucene.document import NumericDocValuesField from org.apache.lucene.index.sorter import SortingMergePolicy from org.apache.lucene.util import BytesRef, Version from org.apache.lucene.analysis.core import WhitespaceAnalyzer from meresco_oai import initVM OAI_VM = initVM() from org.meresco.oai import OaiSortingCollector globals().update(locals())
def lazyImport(): global imported if imported: return from meresco.pylucene import getJVM getJVM() from java.nio.file import Paths from org.apache.lucene.document import Document, StringField, Field, FieldType from org.apache.lucene.search import IndexSearcher, TermQuery from org.apache.lucene.index import DirectoryReader, Term, IndexWriter, IndexWriterConfig, IndexOptions from org.apache.lucene.store import FSDirectory from org.apache.lucene.util import Version from org.apache.lucene.analysis.core import WhitespaceAnalyzer UNINDEXED_TYPE = FieldType() UNINDEXED_TYPE.setIndexOptions(IndexOptions.NONE) UNINDEXED_TYPE.setStored(True) UNINDEXED_TYPE.setTokenized(False) imported = True globals().update(locals())
from meresco.oai import OaiDownloadProcessor, UpdateAdapterFromOaiDownloadProcessor from seecr.utils import DebugPrompt from threading import Thread from meresco.lucene import LuceneSettings, DrilldownField, FieldsListToLuceneDocument from meresco.pylucene import getJVM from meresco.lucene import Lucene, MultiLucene, UNTOKENIZED_PREFIX from meresco.lucene.adaptertolucenequery import AdapterToLuceneQuery from meresco.lucene.remote import LuceneRemoteService from meresco.lucene.fieldregistry import FieldRegistry from .dctofieldslist import DcToFieldsList from .dcfields import DcFields LUCENE_VM = getJVM() myPath = dirname(abspath(__file__)) dynamicPath = join(myPath, 'dynamic') binDir = join(dirname(dirname(myPath)), "bin") def untokenizedFieldname(fieldname): return UNTOKENIZED_PREFIX + fieldname UNQUALIFIED_TERM_FIELDS = [('__all__', 1.0)] drilldownFields = [ DrilldownField(untokenizedFieldname('dc:date')), DrilldownField(untokenizedFieldname('dc:subject')), ] untokenizedFieldnames = [f.name for f in drilldownFields]
mydir = dirname(abspath(__file__)) #DO_NOT_DISTRIBUTE srcDir = join(dirname(dirname(mydir)), 'src_pylucene') #DO_NOT_DISTRIBUTE libDir = join(dirname(dirname(mydir)), 'lib') #DO_NOT_DISTRIBUTE sofile = join(libDir, 'meresco_lucene', '_meresco_lucene.so') #DO_NOT_DISTRIBUTE merescoLuceneFiles = chain(*[[join(d,f) for f in fs if f.endswith(".java")] #DO_NOT_DISTRIBUTE for d, _, fs in walk(join(srcDir, 'org'))]) #DO_NOT_DISTRIBUTE lastMtime = max(stat(f).st_mtime for f in merescoLuceneFiles) #DO_NOT_DISTRIBUTE if not isfile(sofile) or stat(sofile).st_mtime < lastMtime: #DO_NOT_DISTRIBUTE result = system('cd %s; ./build.sh' % srcDir) #DO_NOT_DISTRIBUTE if result: #DO_NOT_DISTRIBUTE exit(result) #DO_NOT_DISTRIBUTE sysPath.insert(0, libDir) #DO_NOT_DISTRIBUTE from meresco.pylucene import getJVM VM = getJVM() from meresco_lucene import initVM VMM = initVM() from fieldregistry import SORTED_PREFIX, UNTOKENIZED_PREFIX, KEY_PREFIX, NUMERIC_PREFIX, RANGE_DOUBLE_PREFIX from _version import version from luceneresponse import LuceneResponse from _lucene import Lucene from lucenesettings import LuceneSettings from fields2lucenedoc import Fields2LuceneDoc from multilucene import MultiLucene from composedquery import ComposedQuery from drilldownfield import DrilldownField from fieldslisttolucenedocument import FieldsListToLuceneDocument from utils import readFixedBitSet
sofile = join(libDir, 'meresco_lucene', '_meresco_lucene.so') #DO_NOT_DISTRIBUTE merescoLuceneFiles = chain(*[ [join(d, f) for f in fs if f.endswith(".java")] #DO_NOT_DISTRIBUTE for d, _, fs in walk(join(srcDir, 'org')) ]) #DO_NOT_DISTRIBUTE lastMtime = max(stat(f).st_mtime for f in merescoLuceneFiles) #DO_NOT_DISTRIBUTE if not isfile(sofile) or stat(sofile).st_mtime < lastMtime: #DO_NOT_DISTRIBUTE result = system('cd %s; ./build.sh' % srcDir) #DO_NOT_DISTRIBUTE if result: #DO_NOT_DISTRIBUTE exit(result) #DO_NOT_DISTRIBUTE sysPath.insert(0, libDir) #DO_NOT_DISTRIBUTE from meresco.pylucene import getJVM VM = getJVM() from meresco_lucene import initVM VMM = initVM() from fieldregistry import SORTED_PREFIX, UNTOKENIZED_PREFIX, KEY_PREFIX, NUMERIC_PREFIX, RANGE_DOUBLE_PREFIX from _version import version from luceneresponse import LuceneResponse from _lucene import Lucene from lucenesettings import LuceneSettings from fields2lucenedoc import Fields2LuceneDoc from multilucene import MultiLucene from composedquery import ComposedQuery from drilldownfield import DrilldownField from fieldslisttolucenedocument import FieldsListToLuceneDocument from utils import readFixedBitSet