gsmiller commented on code in PR #974: URL: https://github.com/apache/lucene/pull/974#discussion_r912362078
########## lucene/demo/src/java/org/apache/lucene/demo/facet/DistanceFacetsExample.java: ########## @@ -212,7 +212,26 @@ public static Query getBoundingBoxQuery( } /** User runs a query and counts facets. */ - public FacetResult search() throws IOException { + public FacetResult searchAllChildren() throws IOException { + + FacetsCollector fc = searcher.search(new MatchAllDocsQuery(), new FacetsCollectorManager()); + + Facets facets = + new DoubleRangeFacetCounts( + "field", + getDistanceValueSource(), + fc, + getBoundingBoxQuery(ORIGIN_LATITUDE, ORIGIN_LONGITUDE, 10.0), + ONE_KM, + TWO_KM, + FIVE_KM, + TEN_KM); + + return facets.getAllChildren("field"); + } + + /** User runs a query and counts facets. */ + public FacetResult searchTopChildren() throws IOException { Review Comment: Thanks! I don't think this is quite what I was suggesting, but maybe it's OK? Or maybe I haven't had enough coffee yet and am misreading your change? But the idea I was proposing would be to faceting on one-hour buckets, not a trailing window as you have. So each range would only be one hour "wide", but we'd cover an entire week's worth of them. This type of log analysis is something you might want to do in the real-world, where you want to understand how many errors occurred in each hour over the last week. So you're essentially creating a histogram of error counts over a week-long time period (in one-hour granularity). And then you're answering the question, "what are the top-5 hours that contained the most errors?" Does this make sense? I think what you have here is a "trailing window" sort of thing that grows but the endpoint is always at "now"? I'm not sure this is all that interesting of an example since the larger ranges will _always_ contain more errors right? Sorry if I'm mis-reading your new change. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org