This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

lucene module wrapper

The lucene module wrapper takes care of the initialization and threading pitfalls in the JCC API. It automatically initializes the VM when the first object is retrieved from the facade module. It also attaches the current Python thread to the JNI VM environment when it hasn’t been attached before.

The wrapper also solves the problem with JVM installing its own signal handlers. By default the JVM overwrites Python’s signal handlers in initVM(), thus causing some hard to debug problems. For example SIGINT is no longer translated into a KeyboradInterrupt exception. The wrapper code restores all signal handlers to its former state. Only JVM’s SIGSEGV handler is left in place because it logs and prints useful information when the JVM segfaults.

The classpath argument is optional. When no classpath is set, smc.lucene automatically adds classpath=lucene.CLASSPATH for you.

Example 1 - Initialize Lucene on demand

Replace code like:

import lucene
lucene.initVM(classpath=lucene.CLASSPATH, vmwargs='...')

def query_lucene(...):
    query = lucene.BooleanQuery()


from smc.lucene import lucene

def query_lucene(...):
    query = lucene.BooleanQuery()

Lucene is automatically initialized when the BooleanQuery attribute is retrieved from the facade module. If PyLucene was already initialized the facade module makes sure that the current thread is attached.

You must not assign Lucene attributes to objects which a shared across threads. If you have to share an object across threads you must call lucene.attach() before you can use an object.

Example 2 - Explicit initialization of Lucene


from smc.lucene import lucene as lucene_wrapper
from lucene import BooleanQuery

def query_lucene(...):
    query = BooleanQuery()

The attach method either initializes lucene or or attaches the current thread.


Christian Heimes

Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting