lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rao, Vaijanath" <vaijanath....@corp.aol.com>
Subject RE: solution for parent-child relationship
Date Wed, 23 Dec 2009 13:45:35 GMT
Hi Shahid,

This is just one of the ways to get it.

You can have an id to your post and comment for every post get's an
subID so for example

Post 1 get id 2566 and comment 1 in that post get id 2566-64. You can
use various methods to get this ID.  Then you can write your own Hit
Collector in which you can collect the results and display the top-10 or
all unique posts.

--Thanks and Regards
Vaijanath N. Rao

-----Original Message-----
From: Shahid Faiz [mailto:developer.inbox@gmail.com] 
Sent: Wednesday, December 23, 2009 7:06 PM
To: java-user@lucene.apache.org
Subject: solution for parent-child relationship

Hi,

Following are details of my problem and possible solutions which I can
think of. Please suggest which should I choose, or is there any other
approach better than these.

I want to index blog posts and their comments, in my database posts and
comments are stored in two different tables. Currently I am indexing
posts only and search works perfectly fine, but now I want to index
comments as well. From now on when user will search any word, all posts
will be displayed which meet search criteria including posts and only
those comments which meet the specified criteria along with posts. All
paging is done on posts, comments are not considered while calculating
page contents.

e.g.

POST =>          Google launched Chrome Browser
COMMENT =>  Microsoft IE also has tab browsing.

Now searching (microsoft AND IE), should also display this post with
along with above comment.

One solution is: I should index both posts+comments in one lucene index
and search that index. But as i have to display 10 posts (not including
comments) per page so it gets complicated while finding records to be
displayed on any given page. I think, I can solve this problem by
creating two queries one to search posts and one to search comments only
and then can join them using OR operator.

Second solution could be: I can store comments in different index, and
on search first I will execute query on comments index and use result of
comments search to search blog posts.

Thanks in advance.

- deve

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