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: one to many relationship
Date Tue, 03 Nov 2009 11:03:22 GMT
> Could anyone comment on how should I handle one-to-many relationship of
> domain objects in lucene? I have been searching the archive but was unable
> to find any answer. I have read about Compass but I am afraid it will also
> cost some performance penalty, any link to performance comparison will be
> really helpful.

Sorry, can't give you any Compass info but from posts to this list it
appears to be fairly well used.  And there is a good argument that you
shouldn't worry about performance in advance.

> In my application, I have two entities e.g Article and Group. One article
> can be categorized under zero or many groups. I don't need to index groups
> data but while indexing Articles, I have to store groups information (at
> least group ids) with each article, so that user can search articles in a
> particular group.

Just do as you say: store the group ids with each article e.g.

id: article1
text: some text about something
groupid: 100 200 300

id: article2
text: some other text about something else
groupid: 400

Then you can add a groupid: nnn clause to your query.  As ever, you'll
need to make sure that you use a suitable analyzer at indexing and
search time.


--
Ian.

---------------------------------------------------------------------
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