lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Lea <ian....@gmail.com>
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, ...);
  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, 齐保元 <qibaoyuan@126.com> 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: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message