Newbie: document count and facets

2011-10-10 Thread kenneth hansen

hello,
I'm quite new to Solr and are trying to get a grip on it all. I'm currently 
reading and enjoying the "Solr 1.4 Enterprise Search Server" book. I'm trying 
and failing and need some advise on the following.
 
given the following schema for "subscriptions"
 


   
   
   


   
   
   
   

subscriptionId

 
I would like to group per accountId, and facet the isClosed per accountId. In 
addition, I would like to see the number of created subscriptions since a given 
date. Would that be possible? I just can't figure out how to do the grouping...
 
Something like this:
 
Number of subscriptions for accountId 12345:  100
Created subscriptions since 01/01/2011:  70 
Closed subscriptions: 10

any advise would be highly appreciated
 
regards,
Kenneth   

RE: Newbie: document count and facets

2011-10-11 Thread kenneth hansen

ok, 
I'll try to answer this myself. Would this be correct to give me the data I 
need?
 
http://localhost:8080/solr-3.3.0/select/?
q=accountId:12345
&start=0
&rows=10
&indent=on
&facet=true
&facet.date=createdDate
&f.createdDate.facet.date.start=NOW/DAYS-1MONTHS
&f.createdDate.facet.date.end=NOW
&f.createdDate.facet.date.gap=%2b1MONTH
&facet.field=isClosed
&facet.mincount=1

 

> From: kenh...@hotmail.co.uk
> To: solr-user@lucene.apache.org
> Subject: Newbie: document count and facets
> Date: Mon, 10 Oct 2011 14:47:07 +0100
> 
> 
> hello,
> I'm quite new to Solr and are trying to get a grip on it all. I'm currently 
> reading and enjoying the "Solr 1.4 Enterprise Search Server" book. I'm trying 
> and failing and need some advise on the following.
> 
> given the following schema for "subscriptions"
> 
> 
> 
>  omitNorms="true"/>
>  precisionStep="0" positionIncrementGap="0"/>
>  omitNorms="true"/>
> 
> 
>  multiValued="false" required="true"/>
>  multiValued="false"/>
>  multiValued="false"/>
>  multiValued="false"/>
> 
> subscriptionId
> 
> 
> I would like to group per accountId, and facet the isClosed per accountId. In 
> addition, I would like to see the number of created subscriptions since a 
> given date. Would that be possible? I just can't figure out how to do the 
> grouping...
> 
> Something like this:
> 
> Number of subscriptions for accountId 12345: 100
> Created subscriptions since 01/01/2011: 70 
> Closed subscriptions: 10
> 
> any advise would be highly appreciated
> 
> regards,
> Kenneth 
  

Faceting with null dates

2011-12-14 Thread kenneth hansen

hello,I have the following faceting parameters, which gives me some unwanted 
non-null dates in the result set. Is there a way to query the index to not give 
me non-null dates in return? I.e. I would like to get a result set which 
contains only non-nulls on the validToDate, but as I am faceting on non-null 
values on the validToDate, I would like to get the non-null values in the 
faceting result. This response example below gives me 10 results, with 7 
non-null validToDates. What I would like to get is 3 results and 7 non-null 
validToDate facets. And as I write this, I start to wonder if this is possible 
at all as the facets are dependent on the result set and that this might be 
better to handle in the application layer by just extracting 10-7=3...
Any help would be appreciated!
br,ken
trueNOW/DAYS-4MONTHS1(*:*)validToDateNOW/DAY+1DAY+1MONTH

  7

  

RE: Faceting with null dates

2011-12-22 Thread kenneth hansen

yes, 
I see that my question was a bit confusing. But thanks for your answers. 
I will try to clarify a bit.
 
I query on a date field, validToDate. The value for this field is not present 
for 99% of the documents.
What I would like to get is
1) the number of documents for a given date range R1 that do not have a value 
for the validToDate, i.e. the 99% of the documents
2) the number of documents for a given date range R2 that do have a value for 
the validToDate
 
My question is really: is it possible to have just one query, or do I need to 
have two queries; one for 1) and one for 2). Will the "facet.range.other=all" 
help me in any way here?
 
/k

 

> Date: Thu, 15 Dec 2011 12:25:12 -0800
> From: hossman_luc...@fucit.org
> To: solr-user@lucene.apache.org
> Subject: Re: Faceting with null dates
> 
> 
> First of all, we need to clarify some terminology here: there is no such 
> thing as a "null date" in solr -- or for that matter, there is no such 
> thing as a "full value" in any field. documents either have some value(s) 
> for a field, or they do not hvae any values.
> 
> If you want to constrain your query to only documents that have a value in 
> a field, you can use something like fq=field_name:[* TO *] ... if you want 
> to constraint your query to only documents that do *NOT* have a value in a 
> field, you can use fq=-field_name:[* TO *]
> 
> Now, having said that, like Erick, i'm a little confused by your question 
> -- it's not clear if what you really want to do is:
> 
> a) change the set of documents returned in the main result list
> b) change the set of documents considered when generating facet counts 
> (w/o changing the main result list)
> c) return an additional count of documents that are in the main result 
> list, but are not in the facet counts because they do not have the field 
> being faceted on.
> 
> My best guess is that you are asking about "c" based on your last 
> sentence...
> 
> : get is 3 results and 7 non-null validToDate facets. And as I write this, 
> : I start to wonder if this is possible at all as the facets are dependent 
> : on the result set and that this might be better to handle in the 
> : application layer by just extracting 10-7=3...
> 
> ...subtracting the sum of all constraint counts from your range facet from 
> the total number of documents found won't neccessarily tell you the number 
> of documents that have no value in the field you are faceting on -- 
> because documents may have values out side the range of your start/end.
> 
> Depending on what exactly it is you are looking for, you might find the 
> "facet.range.other=all" param useful, as it will return things like the 
> "between" counts (summing up all the docs between start->end) as well as 
> the "before" and "after" counts.
> 
> But if you really just want to know "how many docs have no value for my 
> validToDate field?" you can get that very explicitly and easily using 
> facet.query=-validToDate:[* TO *]
> 
> : true : name="f.validToDate.facet.range.start">NOW/DAYS-4MONTHS : name="facet.mincount">1(*:*) : name="facet.range">validToDate : name="facet.range.end">NOW/DAY+1DAY : name="facet.range.gap">+1MONTH
> : 
> :  : name="facet_counts">  
> :  7
> 
> 
> -Hoss