lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erick Erickson <>
Subject Re: Faceting on multivalued field
Date Sun, 03 Apr 2011 22:59:20 GMT
Hmmm, I think you're misunderstanding faceting. It's counting the
number of documents that have a particular value. So if you're
faceting on "comment_post_id", there is one and only one document
with that value (assuming that the comment_post_ids are unique).
Which is what's being reported.... This will be quite expensive on a
large corpus, BTW.

Is your task to show the totals for *every* document in your corpus or
just the ones in a display page? Because if the latter, your app could
just count up the number of elements in the XML returned for the
multiValued comments field.

If that's not relevant, could you explain a bit more why you need this


On Sun, Apr 3, 2011 at 2:31 PM, Kaushik Chakraborty <>wrote:

> Hi,
> My index contains a root entity "Post" and a child entity "Comments". Each
> post can have multiple comments. data-config.xml:
> <document>
>            <entity name="posts" transformer="TemplateTransformer"
> dataSource="jdbc" query="">
>                <field column="post_id" />
>                <field column="post_text"/>
>                <field column="person_id"/>
>                <entity name="comments" dataSource="jdbc" query="select *
> from comments where post_id = ${posts.post_id}" >
>                    <field column="comment_id" />
>                    <field column="comment_text" />
>                    <field column="comment_person_id" />
>                    <field column="comment_post_id" />
>               </entity>
>            </entity>
> </document>
> The schema has all columns of "comment" entity as "MultiValued" fields and
> all fields are indexed & stored. My requirement is to count the number of
> comments for each post. Approach I'm taking is to query on "*:*" and
> faceting the result on "comment_post_id" so that it gives the count of
> comment occurred for that post.
> But I'm getting incorrect result e.g. if a post has 2 comments, the
> multivalued fields are populated alright but the facet count is coming as 1
> (for that post_id). What else do I need to do?
> Thanks,
> Kaushik

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message