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 Dirk Rothe <d....@semantics.de> on 2010/06/09 17:36:52 UTC

instantiating Set()

I'm trying to play with extractTerms() a method of the Query() class[1].  
This method expects a java Set<Term> instance - but instantiating one  
failes with a NotImplementedError. Any clues whats missing:

=================================================
In [1]: import lucene

In [2]: lucene.initVM()
Out[2]: <jcc.JCCEnv object at 0x005BD3B0>

In [3]: lucene.Se
lucene.Searchable                    lucene.SegmentInfo                    
lucene.SerialMergeScheduler
lucene.Searcher                      lucene.SegmentInfos                   
lucene.Serializable
lucene.SecurityException             lucene.SegmentInfos$FindSegmentsFile  
lucene.Set
lucene.SecurityManager               lucene.SegmentReader                  
lucene.SetBasedFieldSelector

In [3]: lucene.Set
Out[3]: <type 'Set'>

In [4]: lucene.Set()
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
===================================================

thnx, dirk

[1]  
http://lucene.apache.org/java/3_0_1/api/all/org/apache/lucene/search/Query.html#extractTerms(java.util.Set)

Re: instantiating Set()

Posted by Dirk Rothe <d....@semantics.de>.
On Wed, 09 Jun 2010 17:47:47 +0200, Andi Vajda <va...@apache.org> wrote:

>
> On Jun 9, 2010, at 8:36, "Dirk Rothe" <d....@semantics.de> wrote:
>
>> I'm trying to play with extractTerms() a method of the Query() class 
>> [1]. This method expects a java Set<Term> instance - but instantiating  
>> one failes with a NotImplementedError. Any clues whats missing:
>
> A Java Set is an interface and as such cannot be instantiated. Instead,  
> use a Java class such as TreeSet or HashSet that implements this  
> interface.
>
> PyLucene also ships with PythonSet, a Java implentation of Set backed by  
> a Python set. See module in PyLucene's python directory.

Aah, yes I see - a HashSet works as expected. Thnx a lot for the obviously  
non-pylucene-related help.

--dirk

Re: instantiating Set()

Posted by Andi Vajda <va...@apache.org>.
On Jun 9, 2010, at 8:36, "Dirk Rothe" <d....@semantics.de> wrote:

> I'm trying to play with extractTerms() a method of the Query() class 
> [1]. This method expects a java Set<Term> instance - but  
> instantiating one failes with a NotImplementedError. Any clues whats  
> missing:

A Java Set is an interface and as such cannot be instantiated.  
Instead, use a Java class such as TreeSet or HashSet that implements  
this interface.

PyLucene also ships with PythonSet, a Java implentation of Set backed  
by a Python set. See module in PyLucene's python directory.

Andi..

>
> =================================================
> In [1]: import lucene
>
> In [2]: lucene.initVM()
> Out[2]: <jcc.JCCEnv object at 0x005BD3B0>
>
> In [3]: lucene.Se
> lucene.Searchable                     
> lucene.SegmentInfo                   lucene.SerialMergeScheduler
> lucene.Searcher                       
> lucene.SegmentInfos                  lucene.Serializable
> lucene.SecurityException             lucene.SegmentInfos 
> $FindSegmentsFile lucene.Set
> lucene.SecurityManager                
> lucene.SegmentReader                 lucene.SetBasedFieldSelector
>
> In [3]: lucene.Set
> Out[3]: <type 'Set'>
>
> In [4]: lucene.Set()
> --- 
> --- 
> ---------------------------------------------------------------------
> NotImplementedError                       Traceback (most recent  
> call last)
> ===================================================
>
> thnx, dirk
>
> [1] http://lucene.apache.org/java/3_0_1/api/all/org/apache/lucene/search/Query.html#extractTerms(java.util.Set)