Re: Faceting and multiValued field type

2016-01-19 Thread Erick Erickson
Yes.

What do you mean "how does it work"? The low-level
details or what?

Basically, faceting just... facets. I.e. for each unique
value in the field specified it counts the number of
docs in the result set that have that value.

So if you have a doc with two dates and facet on that
field, say 1/1/2015 and 1/1/2016,
that doc will be counted in each bucket.

Best,
Erick

On Tue, Jan 19, 2016 at 8:48 AM, Steven White  wrote:
> Hi everyone,
>
> Can I use facet on a field type of multiValued?  If so, how does facet work
> with field type of "date" set as multiValued?
>
> Thanks
>
> Steve


Re: Faceting and multiValued field type

2016-01-19 Thread Steven White
My apology for not being clear -- I left out the keyword "range search"
with facet.  Let me try again.

Using DateRangeField field type, if this field is multiValued and I have 3
date values stored for one record, 5 for another, etc., which of those date
values will be used for faceting when I use range-search faceting on this
field?

Don't I have the same issue on other field types when it comes to range
searches?  Such as CurrencyField, or int, float, etc.

-- George

On Tue, Jan 19, 2016 at 1:10 PM, Erick Erickson 
wrote:

> Yes.
>
> What do you mean "how does it work"? The low-level
> details or what?
>
> Basically, faceting just... facets. I.e. for each unique
> value in the field specified it counts the number of
> docs in the result set that have that value.
>
> So if you have a doc with two dates and facet on that
> field, say 1/1/2015 and 1/1/2016,
> that doc will be counted in each bucket.
>
> Best,
> Erick
>
> On Tue, Jan 19, 2016 at 8:48 AM, Steven White 
> wrote:
> > Hi everyone,
> >
> > Can I use facet on a field type of multiValued?  If so, how does facet
> work
> > with field type of "date" set as multiValued?
> >
> > Thanks
> >
> > Steve
>


Re: Faceting and multiValued field type

2016-01-19 Thread Erick Erickson
bq: which of those date values will be used for faceting when I
use range-search faceting on this field?

All of them. Which values match in a multiValued field, range
query or not, have no bearing on the facet counts. Faceting
essentially says "take all the docs that match the query and,
for each unique value in the field being faceted upon, tell
me how many of the docs have that value."

So I have docs with a multivalued field f1 like this
doc1 f1=>a,b,c,d
doc2 f1=>c,d,e,f

q=f1:[b TO c]

Both docs are hits, and you get back facets like
a-1
b-1
c-2
d-2
e-1
f-1

q=*:*, q=f1:c would give the same facet counts.

Best,
Erick

On Tue, Jan 19, 2016 at 11:28 AM, Steven White  wrote:
> My apology for not being clear -- I left out the keyword "range search"
> with facet.  Let me try again.
>
> Using DateRangeField field type, if this field is multiValued and I have 3
> date values stored for one record, 5 for another, etc., which of those date
> values will be used for faceting when I use range-search faceting on this
> field?
>
> Don't I have the same issue on other field types when it comes to range
> searches?  Such as CurrencyField, or int, float, etc.
>
> -- George
>
> On Tue, Jan 19, 2016 at 1:10 PM, Erick Erickson 
> wrote:
>
>> Yes.
>>
>> What do you mean "how does it work"? The low-level
>> details or what?
>>
>> Basically, faceting just... facets. I.e. for each unique
>> value in the field specified it counts the number of
>> docs in the result set that have that value.
>>
>> So if you have a doc with two dates and facet on that
>> field, say 1/1/2015 and 1/1/2016,
>> that doc will be counted in each bucket.
>>
>> Best,
>> Erick
>>
>> On Tue, Jan 19, 2016 at 8:48 AM, Steven White 
>> wrote:
>> > Hi everyone,
>> >
>> > Can I use facet on a field type of multiValued?  If so, how does facet
>> work
>> > with field type of "date" set as multiValued?
>> >
>> > Thanks
>> >
>> > Steve
>>


Re: faceting from multiValued field

2013-09-10 Thread Rafał Kuć
Hello!

Your field needs to be indexed in order for faceting to work.

-- 
Regards,
 Rafał Kuć
 Sematext :: http://sematext.com/ :: Solr - Lucene - ElasticSearch

 Hi,

 I am having a problem with multiValued field and Faceting

 This is the schema:
 field name=series type=string indexed=false stored=true
 required=false omitTermFreqAndPositions=true multiValued=true /

 all I get is:
 lst name=series /


 Note: the data is correctly placed in the field as the query results shows.
 However, the facet is not working.

 Could anyone tell me how to achieve it?

 Thanks a lot.




Re: faceting from multiValued field

2013-09-10 Thread Raheel Hasan
wow, that did it... fantastic... Thanks a lot :)


On Tue, Sep 10, 2013 at 3:56 PM, Rafał Kuć r@solr.pl wrote:

 Hello!

 Your field needs to be indexed in order for faceting to work.

 --
 Regards,
  Rafał Kuć
  Sematext :: http://sematext.com/ :: Solr - Lucene - ElasticSearch

  Hi,

  I am having a problem with multiValued field and Faceting

  This is the schema:
  field name=series type=string indexed=false stored=true
  required=false omitTermFreqAndPositions=true multiValued=true /

  all I get is:
  lst name=series /


  Note: the data is correctly placed in the field as the query results
 shows.
  However, the facet is not working.

  Could anyone tell me how to achieve it?

  Thanks a lot.





-- 
Regards,
Raheel Hasan


Re: Faceting on multivalued field

2011-04-04 Thread Kaushik Chakraborty
Are you implying to change the DB query of the nested entity which fetches
the comments (query is in my post) or something can be done during the index
like using Transformers etc. ?

Thanks,
Kaushik


On Mon, Apr 4, 2011 at 8:07 AM, Erick Erickson erickerick...@gmail.comwrote:

 Why not count them on the way in and just store that number along
 with the original e-mail?

 Best
 Erick

 On Sun, Apr 3, 2011 at 10:10 PM, Kaushik Chakraborty kaych...@gmail.com
 wrote:

  Ok. My expectation was since comment_post_id is a MultiValued field
 hence
  it would appear multiple times (i.e. for each comment). And hence when I
  would facet with that field it would also give me the count of those many
  documents where comment_post_id appears.
 
  My requirement is getting total for every document i.e. finding number of
  comments per post in the whole corpus. To explain it more clearly, I'm
  getting a result xml something like this
 
  str name=post_id46/str
  str name=post_textHello World/str
  str name=person_id20/str
  arr name=comment_id
 str9/str
 str10/str
  /arr
  arr name=comment_person_id
str19/str
str2/str
  /arr
  arr name=comment_post_id
   str46/str
   str46/str
  /arr
  arr name=comment_text
strHello - from World/str
strHi/str
  /arr
 
  lst name=facet_fields
   lst name=comment_post_id
  *int name=461/int*
 
  I need the count to be 2 as the post 46 has 2 comments.
 
   What other way can I approach?
 
  Thanks,
  Kaushik
 
 
  On Mon, Apr 4, 2011 at 4:29 AM, Erick Erickson erickerick...@gmail.com
  wrote:
 
   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
   count?
  
   Best
   Erick
  
   On Sun, Apr 3, 2011 at 2:31 PM, Kaushik Chakraborty 
 kaych...@gmail.com
   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
   
  
 



RE: Faceting on multivalued field

2011-04-04 Thread Jonathan Rochkind
Is there a kind of function query that can count number of values in a 
multi-valued field on a given document?  I do not know. 

From: Erick Erickson [erickerick...@gmail.com]
Sent: Sunday, April 03, 2011 10:37 PM
To: solr-user@lucene.apache.org
Subject: Re: Faceting on multivalued field

Why not count them on the way in and just store that number along
with the original e-mail?

Best
Erick

On Sun, Apr 3, 2011 at 10:10 PM, Kaushik Chakraborty kaych...@gmail.comwrote:

 Ok. My expectation was since comment_post_id is a MultiValued field hence
 it would appear multiple times (i.e. for each comment). And hence when I
 would facet with that field it would also give me the count of those many
 documents where comment_post_id appears.

 My requirement is getting total for every document i.e. finding number of
 comments per post in the whole corpus. To explain it more clearly, I'm
 getting a result xml something like this

 str name=post_id46/str
 str name=post_textHello World/str
 str name=person_id20/str
 arr name=comment_id
str9/str
str10/str
 /arr
 arr name=comment_person_id
   str19/str
   str2/str
 /arr
 arr name=comment_post_id
  str46/str
  str46/str
 /arr
 arr name=comment_text
   strHello - from World/str
   strHi/str
 /arr

 lst name=facet_fields
  lst name=comment_post_id
 *int name=461/int*

 I need the count to be 2 as the post 46 has 2 comments.

  What other way can I approach?

 Thanks,
 Kaushik


 On Mon, Apr 4, 2011 at 4:29 AM, Erick Erickson erickerick...@gmail.com
 wrote:

  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
  count?
 
  Best
  Erick
 
  On Sun, Apr 3, 2011 at 2:31 PM, Kaushik Chakraborty kaych...@gmail.com
  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
  
 



Re: Faceting on multivalued field

2011-04-03 Thread Erick Erickson
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
count?

Best
Erick

On Sun, Apr 3, 2011 at 2:31 PM, Kaushik Chakraborty kaych...@gmail.comwrote:

 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



Re: Faceting on multivalued field

2011-04-03 Thread Chris Fauerbach
Wouldn't you want to extract your original data format from the index and then 
'count' the comments for each post ? 
I don't think facets are appropriate. 

On Apr 3, 2011, at 22:10, Kaushik Chakraborty kaych...@gmail.com wrote:

 Ok. My expectation was since comment_post_id is a MultiValued field hence
 it would appear multiple times (i.e. for each comment). And hence when I
 would facet with that field it would also give me the count of those many
 documents where comment_post_id appears.
 
 My requirement is getting total for every document i.e. finding number of
 comments per post in the whole corpus. To explain it more clearly, I'm
 getting a result xml something like this
 
 str name=post_id46/str
 str name=post_textHello World/str
 str name=person_id20/str
 arr name=comment_id
str9/str
str10/str
 /arr
 arr name=comment_person_id
   str19/str
   str2/str
 /arr
 arr name=comment_post_id
  str46/str
  str46/str
 /arr
 arr name=comment_text
   strHello - from World/str
   strHi/str
 /arr
 
 lst name=facet_fields
  lst name=comment_post_id
 *int name=461/int*
 
 I need the count to be 2 as the post 46 has 2 comments.
 
 What other way can I approach?
 
 Thanks,
 Kaushik
 
 
 On Mon, Apr 4, 2011 at 4:29 AM, Erick Erickson erickerick...@gmail.comwrote:
 
 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
 count?
 
 Best
 Erick
 
 On Sun, Apr 3, 2011 at 2:31 PM, Kaushik Chakraborty kaych...@gmail.com
 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
 
 


Re: Faceting on multivalued field

2011-04-03 Thread Erick Erickson
Why not count them on the way in and just store that number along
with the original e-mail?

Best
Erick

On Sun, Apr 3, 2011 at 10:10 PM, Kaushik Chakraborty kaych...@gmail.comwrote:

 Ok. My expectation was since comment_post_id is a MultiValued field hence
 it would appear multiple times (i.e. for each comment). And hence when I
 would facet with that field it would also give me the count of those many
 documents where comment_post_id appears.

 My requirement is getting total for every document i.e. finding number of
 comments per post in the whole corpus. To explain it more clearly, I'm
 getting a result xml something like this

 str name=post_id46/str
 str name=post_textHello World/str
 str name=person_id20/str
 arr name=comment_id
str9/str
str10/str
 /arr
 arr name=comment_person_id
   str19/str
   str2/str
 /arr
 arr name=comment_post_id
  str46/str
  str46/str
 /arr
 arr name=comment_text
   strHello - from World/str
   strHi/str
 /arr

 lst name=facet_fields
  lst name=comment_post_id
 *int name=461/int*

 I need the count to be 2 as the post 46 has 2 comments.

  What other way can I approach?

 Thanks,
 Kaushik


 On Mon, Apr 4, 2011 at 4:29 AM, Erick Erickson erickerick...@gmail.com
 wrote:

  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
  count?
 
  Best
  Erick
 
  On Sun, Apr 3, 2011 at 2:31 PM, Kaushik Chakraborty kaych...@gmail.com
  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