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 Bas Peters <ma...@bpeters.com> on 2006/08/13 19:51:26 UTC

Repeatable field names

Hi,

I have a question regarding repeatable field names.

I have a database with, among other fields, a field title and a field 
subtitle. I want to add them to a Lucene index with a field 'title' to 
enable the user to find books by title words that are in the title or 
subtitle. Can I simple add both fields with a field name title (this 
seems to work fine), or is it a better approach (for example more 
efficient) to concatenate both title and subtitle first and add them as 
a single field to the index?

Regards,

Bas Peters


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


Re: Repeatable field names

Posted by Chris Hostetter <ho...@fucit.org>.
: subtitle. Can I simple add both fields with a field name title (this
: seems to work fine), or is it a better approach (for example more
: efficient) to concatenate both title and subtitle first and add them as
: a single field to the index?

there's no reason to concatenate them unless you want to *store* them as
one long string (so you get the value back as a single string instead of
an array of two strings) ... i'm guessing you don't.  from a search
perspective the only difference is that with two values the
positionIncrimentGap method of your analyzer will be called, putting a
"gap" between the last word of hte title and the first word of hte
subtitle ... this can be usefull if you want to make sure that phrase
searches don't falsly match one word in the title and one word in the
subtitle.



-Hoss


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