Hi Peyman,

The API docs give a hint 
<http://lucene.apache.org/java/3_4_0/api/core/org/apache/lucene/index/IndexWriter.html>:

=====
Nested Class Summary
...
static class IndexWriter.MaxFieldLength
        Deprecated. use LimitTokenCountAnalyzer instead.
=====

<http://lucene.apache.org/java/3_4_0/api/core/org/apache/lucene/analysis/LimitTokenCountAnalyzer.html>
 

Also, if you're composing your own Analysis pipeline, you'll likely be 
interested in the Filter variant of the above-linked Analyzer wrapper:

<http://lucene.apache.org/java/3_4_0/api/core/org/apache/lucene/analysis/LimitTokenCountFilter.html>
 

Steve

> -----Original Message-----
> From: Peyman Faratin [mailto:pey...@robustlinks.com]
> Sent: Wednesday, September 28, 2011 9:08 AM
> To: java-user@lucene.apache.org
> Subject: setting MaxFieldLength in indexwriter
> 
> Hi
> 
> Newbie question. I'm trying to set the max field length property of the
> indexwriter to unlimited. The old api is now deprecated but I can't seem
> to be able to figure out how to set the field with the new
> (IndexWriterConfig) API. I've tried
> IndexWriterConfig.maxFieldLength(Integer.MAX_VALUE)  but to no avail. Any
> help would be much appreciated as always
> 
> 
> 
> 
>               File file = new File(stopWordsFile);
>               Directory dir = NIOFSDirectory.open(new File(indexDir));
>               IndexWriterConfig conf = new
> IndexWriterConfig(Version.LUCENE_32,
>                               new StandardAnalyzer(Version.LUCENE_32,file));
> 
>               conf.maxFieldLength(Integer.MAX_VALUE) ;
> 
>               writer = new IndexWriter(dir, conf);
> 
> thank you
> 

Reply via email to