gsmiller commented on code in PR #974:
URL: https://github.com/apache/lucene/pull/974#discussion_r910485371


##########
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:
   Yeah maybe. I think if you can come up with a real-world example that has a 
somewhat high cardinality of children but where you only want a small subset, 
then building an example around that could be useful. Here's one I just thought 
of, but maybe you can come up with something else?
   
   What if, as an example, you indexed error messages in a service log so you 
could do analysis over them. Each document could be an error log entry that 
contains the log message string and also a timestamp for when it occurred. Then 
let's say you wanted to find the top 5 hour periods that had the most errors 
over the past week. To do this, you could create 168 ranges (each for a one 
hour time period; 7 * 24 = 268) and facet on them. Then you could ask for the 
top-5 by count. That would give you the five hour periods over the last week 
with the most errors.



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

Reply via email to