Yuti-G commented on code in PR #974:
URL: https://github.com/apache/lucene/pull/974#discussion_r916342857


##########
lucene/demo/src/java/org/apache/lucene/demo/facet/RangeFacetsExample.java:
##########
@@ -73,6 +76,35 @@ public void index() throws IOException {
       indexWriter.addDocument(doc);
     }
 
+    // Add documents with a fake timestamp, 3600 sec (1 hour) after "now", 
7200 sec (2
+    // hours) after "now", ...:
+    long startTime = 0;
+    // Index error messages since a week (24 * 7 = 168 hours) ago
+    for (int i = 0; i < 168; i++) {
+      long endTime = startTime + (i + 1) * 3600;
+
+      // Choose a relatively larger number, e,g., "35", in order to create 
variation in count for
+      // the top-n children, so that getTopChildren(10) in the 
searchTopChildren functionality
+      // can return children with different counts
+      for (int j = 0; j < i % 35; j++) {
+        Document doc = new Document();
+        // index document at a different timestamp by using endTime - i * j

Review Comment:
   Using `Random` does add some complexity for testing, and I was trying to 
keep it as simple as the current example , but sorry that causes confusion. I 
will create a separate issue to add a top-n range faceting example after this 
pr is merged, and will try to use random and add clear comments to the example 
code. Thanks! 



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