You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Peyman Faratin <pe...@robustlinks.com> on 2011/09/28 15:08:00 UTC

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



Re: setting MaxFieldLength in indexwriter

Posted by Peyman Faratin <pe...@robustlinks.com>.
Ah. Thank you Steve

Peyman


On Sep 28, 2011, at 9:53 AM, Steven A Rowe wrote:

> 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:peyman@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
>> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


RE: setting MaxFieldLength in indexwriter

Posted by Steven A Rowe <sa...@syr.edu>.
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:peyman@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
>