Just add the different subjects to the document e.g.

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

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.


--
Ian.

On Fri, Jul 20, 2012 at 6:59 AM, 齐保元 <[email protected]> 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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to