You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pylucene-dev@lucene.apache.org by Roman Chyla <ro...@gmail.com> on 2011/11/24 18:48:06 UTC

JArray not shared - TypeError

Hi,

I am using lucene together with other modules (all built in shared
mode, JCC=2.11). But JArray... objects are not built as shared

This works when using only lucene, but fails when I use built the
other module linked against lucene

# create array of string objects
x = j.JArray_object(5)
for i in range(5):
   x[i] = j.JArray_string(['x', 'z'])

In [7]: for i in range(5):
   x[i] = j.JArray_string(['x', 'z'])
   ...:
   ...:
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

/dvt/workspace/montysolr/src/python/<ipython console> in <module>()

TypeError: JArray<string>[u'x', u'z']


The JArray functions/objects are different:

In [9]: id(lucene.JArray_string)
Out[9]: 140313957671376

In [10]: id(solr_java.JArray_string)
Out[10]: 140313919877648

In [11]: id(montysolr_java.JArray_string)
Out[11]: 140313909254704

In [12]: id(j.JArray_string)
Out[12]: 140313909254704



Others are shared:

In [18]: id(lucene.Weight)
Out[18]: 140313957203040

In [19]: id(solr_java.Weight)
Out[19]: 140313957203040

In [20]: id(j.Weight)
Out[20]: 140313957203040


The module 'j' is built with:
-m  jcc  --shared  --import  lucene  --import  solr_java  --package
org.apache.solr.request  --classpath ...  --include
../build/jar/montysolr_java-0.1.jar  --python  montysolr_java  --build
 --bdist


What am I doing wrong?

Thanks,

  roman

Re: JArray not shared - TypeError

Posted by Andi Vajda <va...@apache.org>.
On Nov 24, 2011, at 14:48, Roman Chyla <ro...@gmail.com> wrote:

> Hi,
> 
> I am using lucene together with other modules (all built in shared
> mode, JCC=2.11). But JArray... objects are not built as shared
> 
> This works when using only lucene, but fails when I use built the
> other module linked against lucene
> 
> # create array of string objects
> x = j.JArray_object(5)
> for i in range(5):
>   x[i] = j.JArray_string(['x', 'z'])
> 
> In [7]: for i in range(5):
>   x[i] = j.JArray_string(['x', 'z'])
>   ...:
>   ...:
> ---------------------------------------------------------------------------
> TypeError                                 Traceback (most recent call last)
> 
> /dvt/workspace/montysolr/src/python/<ipython console> in <module>()
> 
> TypeError: JArray<string>[u'x', u'z']
> 
> 
> The JArray functions/objects are different:
> 
> In [9]: id(lucene.JArray_string)
> Out[9]: 140313957671376
> 
> In [10]: id(solr_java.JArray_string)
> Out[10]: 140313919877648
> 
> In [11]: id(montysolr_java.JArray_string)
> Out[11]: 140313909254704
> 
> In [12]: id(j.JArray_string)
> Out[12]: 140313909254704
> 
> 
> 
> Others are shared:
> 
> In [18]: id(lucene.Weight)
> Out[18]: 140313957203040
> 
> In [19]: id(solr_java.Weight)
> Out[19]: 140313957203040
> 
> In [20]: id(j.Weight)
> Out[20]: 140313957203040
> 
> 
> The module 'j' is built with:
> -m  jcc  --shared  --import  lucene  --import  solr_java  --package
> org.apache.solr.request  --classpath ...  --include
> ../build/jar/montysolr_java-0.1.jar  --python  montysolr_java  --build
> --bdist
> 
> 
> What am I doing wrong?

Probably nothing. It looks like the JArray type and code should be moved to the jcc package so that it's loaded only once.
You found a bug, please file it.
Thanks !

Andi..

> 
> Thanks,
> 
>  roman