lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ype Kingma <ykin...@xs4all.nl>
Subject Re: Adding multiple paths to a document
Date Tue, 05 Mar 2002 18:32:42 GMT
Grim,

>I am looking at using lucene to index a large set of documents.  In
>order to be able to search a subset of documents, I've added a
>"path"-field to each document (indexed, not stored, not tokenized).
>Using a prefix-query seems to work fine.
>
>My problem: Our documents can have several different paths pointing to
>the same document, so I would like to add several paths to each
>document, and be able to find the document using different
>prefix-queries.
>
>So my question: Is this accomplished simply by adding several fields to
>the document by the same name ?
>
>	  doc.add(new Field("path",
>"/test/path1/misc"),false,true,false));
>	  doc.add(new Field("path",
>"/test/path2/misc"),false,true,false));
>
>This seems to work, but I would like to know if it is the right way.

That's one good way. Adding to a field is possible before passing the
document to an indexwriter. There is an implicit term border between
the add()'s.
Using a single add() with a "path1 path2" field will have the same effect
when the field is tokenized.

Regards,
Ype
-- 

--
To unsubscribe, e-mail:   <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>


Mime
View raw message