lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Lea <>
Subject Re: how to deal with multi subject problem?
Date Fri, 20 Jul 2012 09:10:49 GMT
Just add the different subjects to the document e.g.

Doc doc = new Document();
for (String subject : subjects) {
  Field f = new Field("subject", subject, ...);

Or concatenate the subjects and store the one long string.

If you don't want a search to potentially match terms from multiple
subjects look into phrase queries or spans or position increments.

If you haven't yet read Lucene In Action 2nd edition it would be well
worth doing so.


On Fri, Jul 20, 2012 at 6:59 AM, 齐保元 <> wrote:
> Hi buddy,
>              I have many documents and each document may belong to *MANY* subjects.How
to use Lucene to deal with this situation to meet the demand of seaching under specific subject?

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message