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 Soby Thomas <so...@gmail.com> on 2010/07/03 11:50:12 UTC

Solving lucene.InvalidArgsError

Hi all,

I'm new to PyLucene. I was just trying to understand the indexing part of
the lucene.I have installed PyLucene-3.0.1-1 and Python 2.6

 I wrote a sample code as shown below ,

import sys
import os

lucene.initVM(lucene.CLASSPATH)
store = os.getcwd()+"/index"
text_file = open('brad.mckay@enron.com.txt')

analyzer = lucene.StopAnalyzer()
writer = lucene.IndexWriter(store, analyzer, True)

document = lucene.Document()
document.add(lucence.Field("Subject", text_file, lucene.Field.Store.YES,
lucene.Field.Index.UN_TOKENIZED))
writer.addDocument(document)


When i tried to run the script it is showing me this error...

Traceback (most recent call last):
  File "abc.py", line 9, in <module>
    analyzer = lucene.StopAnalyzer()
lucene.InvalidArgsError: (<type 'StopAnalyzer'>, '__init__', ())


How to solve this....??

Re: Solving lucene.InvalidArgsError

Posted by Andi Vajda <va...@apache.org>.
On Sat, 3 Jul 2010, Soby Thomas wrote:

> I'm new to PyLucene. I was just trying to understand the indexing part of
> the lucene.I have installed PyLucene-3.0.1-1 and Python 2.6
>
> I wrote a sample code as shown below ,
>
> import sys
> import os
>
> lucene.initVM(lucene.CLASSPATH)
> store = os.getcwd()+"/index"
> text_file = open('brad.mckay@enron.com.txt')
>
> analyzer = lucene.StopAnalyzer()
> writer = lucene.IndexWriter(store, analyzer, True)
>
> document = lucene.Document()
> document.add(lucence.Field("Subject", text_file, lucene.Field.Store.YES,
> lucene.Field.Index.UN_TOKENIZED))
> writer.addDocument(document)
>
>
> When i tried to run the script it is showing me this error...
>
> Traceback (most recent call last):
>  File "abc.py", line 9, in <module>
>    analyzer = lucene.StopAnalyzer()
> lucene.InvalidArgsError: (<type 'StopAnalyzer'>, '__init__', ())

The documentation for parameters to lucene classes are best found in the 
lucene javadocs [1] as pylucene is just a wrapper around it.

Andi..

[1] http://lucene.apache.org/java/3_0_1/api/core/index.html
The documentation for StopAnalyzer is here:
http://lucene.apache.org/java/3_0_1/api/core/org/apache/lucene/analysis/StopAnalyzer.html