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 Dave Seltzer <ds...@tveyes.com> on 2012/03/07 15:39:13 UTC

MemoryIndex "field must not be added more than once"

I'm using a MemoryIndex to search in-memory content.

I was wondering if there's a way to specify multiple values for the same
field in a MemoryIndex.

I've tried addField but it throws an exception:

index.addField("foobar", "value1", LuceneAnalyzer);
index.addField("foobar", "value2", LuceneAnalyzer);

java.lang.IllegalArgumentException: field must not be added more than once

Thanks!

-Dave

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


RE: MemoryIndex "field must not be added more than once"

Posted by Dave Seltzer <ds...@tveyes.com>.
Thanks for your help Uwe. I've created an issue:
https://issues.apache.org/jira/browse/LUCENE-3865

-Dave

-----Original Message-----
From: Uwe Schindler [mailto:uwe@thetaphi.de]
Sent: Wednesday, March 07, 2012 3:39 PM
To: java-user@lucene.apache.org
Subject: RE: MemoryIndex "field must not be added more than once"

Hi,

Can you open a bug report in JIRA about this? The IndexWriter/IndexReader
contract allows to add the same field several times (internally
concatenating, but with a positionIncrement gap). If you append the fields
before, phrase queries may behave differently.

Uwe

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de


> -----Original Message-----
> From: Stephen Howe [mailto:silentgunner@gmail.com]
> Sent: Wednesday, March 07, 2012 7:44 PM
> To: java-user@lucene.apache.org
> Subject: Re: MemoryIndex "field must not be added more than once"
>
> Easiest way to do that would be to append all your values together and
then
> add them in one pass. Unfortunately, you can only add a field + values
once.
>
> -Stephen
>
> On Wed, Mar 7, 2012 at 9:39 AM, Dave Seltzer <ds...@tveyes.com>
wrote:
>
> > I'm using a MemoryIndex to search in-memory content.
> >
> > I was wondering if there's a way to specify multiple values for the
> > same field in a MemoryIndex.
> >
> > I've tried addField but it throws an exception:
> >
> > index.addField("foobar", "value1", LuceneAnalyzer);
> > index.addField("foobar", "value2", LuceneAnalyzer);
> >
> > java.lang.IllegalArgumentException: field must not be added more than
> > once
> >
> > Thanks!
> >
> > -Dave
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: java-user-help@lucene.apache.org
> >
> >


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

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


RE: MemoryIndex "field must not be added more than once"

Posted by Uwe Schindler <uw...@thetaphi.de>.
Hi,

Can you open a bug report in JIRA about this? The IndexWriter/IndexReader
contract allows to add the same field several times (internally
concatenating, but with a positionIncrement gap). If you append the fields
before, phrase queries may behave differently.

Uwe

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de


> -----Original Message-----
> From: Stephen Howe [mailto:silentgunner@gmail.com]
> Sent: Wednesday, March 07, 2012 7:44 PM
> To: java-user@lucene.apache.org
> Subject: Re: MemoryIndex "field must not be added more than once"
> 
> Easiest way to do that would be to append all your values together and
then
> add them in one pass. Unfortunately, you can only add a field + values
once.
> 
> -Stephen
> 
> On Wed, Mar 7, 2012 at 9:39 AM, Dave Seltzer <ds...@tveyes.com> wrote:
> 
> > I'm using a MemoryIndex to search in-memory content.
> >
> > I was wondering if there's a way to specify multiple values for the
> > same field in a MemoryIndex.
> >
> > I've tried addField but it throws an exception:
> >
> > index.addField("foobar", "value1", LuceneAnalyzer);
> > index.addField("foobar", "value2", LuceneAnalyzer);
> >
> > java.lang.IllegalArgumentException: field must not be added more than
> > once
> >
> > Thanks!
> >
> > -Dave
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: java-user-help@lucene.apache.org
> >
> >


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


Re: MemoryIndex "field must not be added more than once"

Posted by Stephen Howe <si...@gmail.com>.
Easiest way to do that would be to append all your values together and then
add them in one pass. Unfortunately, you can only add a field + values
once.

-Stephen

On Wed, Mar 7, 2012 at 9:39 AM, Dave Seltzer <ds...@tveyes.com> wrote:

> I'm using a MemoryIndex to search in-memory content.
>
> I was wondering if there's a way to specify multiple values for the same
> field in a MemoryIndex.
>
> I've tried addField but it throws an exception:
>
> index.addField("foobar", "value1", LuceneAnalyzer);
> index.addField("foobar", "value2", LuceneAnalyzer);
>
> java.lang.IllegalArgumentException: field must not be added more than once
>
> Thanks!
>
> -Dave
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>