[pylucene-dev] Creating a class that extends MultiTermQuery
crankycoder at gmail.com
Thu Apr 20 12:40:16 PDT 2006
Thanks for the tips. I think I'm close (probably not), but my C++ is
extremely bad and I can't seem to quite figure out how to get all of this to
Any chance that we'll see the ability to create extensions to Query?
I think all we need to get MultiTermQuery wrappers working are extension
points at the isMultiTermQuery() and getEnum(IndexReader) methods.
On 4/19/06, Andi Vajda <vajda at osafoundation.org> wrote:
> On Wed, 19 Apr 2006, Victor Ng wrote:
> > Hi all,
> > I'm having trouble trying to get PyLucene working with a custom class
> > is supposed to be extending MultiTermQuery.
> There is no out-of-the-box way to extend a Java Lucene class. A number of
> Lucene classes can be extended in PyLucene but these were setup for that
> purpose. More such classes could be setup that way as follows:
> 1. a Java subclass of the Lucene class with native extension points
> needs to
> be defined: see the classes in java/org/osafoundation/search for
> 2. the c++ methods for these extension points need to be implemented to
> the equivalent python methods on the python instance they wrap: see
> cpp/PythonSearch.cpp for examples
> 3. the API wrappers in lucene.cpp accepting these extension instances
> have to
> be taught to recognize them as such and wrap whem with an instance of
> java subclass you created in step 1. Look at the method wrapping the
> SortField constructor in lucene.cpp, j_sortfield_init(). The case 2:
> section tries an argument signature of "sP", which means 'string'
> by a Java instance of a given class *or* a matching python extension.
> Yes, this is tricky. The reason this is so is because the PyLucene objects
> not extensions of Lucene objects but wrappers. The java side has no idea
> this and will not invoke a method override on a python wrapper object.
> pylucene-dev mailing list
> pylucene-dev at osafoundation.org
"Never attribute to malice that which can be adequately explained by
stupidity." - Hanlon's Razor
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the pylucene-dev