lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Lu <chris...@gmail.com>
Subject Re: one to many relationship
Date Thu, 05 Nov 2009 18:19:27 GMT
Shahid, As Ian described, for one-to-many relationships, you need to 
flatten the relationship and store it into Documents.

It's not efficient to search for Articles, and then based on the results 
to search for related groups.
The database "good" 3NF model does not apply to Lucene for performance 
reason.

--
Chris Lu
-------------------------
Instant Scalable Full-Text Search On Any Database/Application
site: http://www.dbsight.net
demo: http://search.dbsight.com
Lucene Database Search in 3 minutes: http://wiki.dbsight.com/index.php?title=Create_Lucene_Database_Search_in_3_minutes
DBSight customer, a shopping comparison site, (anonymous per request) got 2.6 Million Euro
funding!


Ian Lea wrote:
>> 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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message