[GitHub] [lucene-solr] munendrasn commented on a change in pull request #1334: SOLR-8306: Enhance ExpandComponent to allow expand.hits=0
munendrasn commented on a change in pull request #1334: SOLR-8306: Enhance ExpandComponent to allow expand.hits=0 URL: https://github.com/apache/lucene-solr/pull/1334#discussion_r393132417 ## File path: solr/solr-ref-guide/src/collapse-and-expand-results.adoc ## @@ -142,6 +142,8 @@ The “expand=true” parameter turns on the ExpandComponent. The ExpandComponen Inside the expanded section there is a _map_ with each group head pointing to the expanded documents that are within the group. As applications iterate the main collapsed result set, they can access the _expanded_ map to retrieve the expanded groups. +If you would like to have only the number of documents found from the groups in the expanded section returned and not the actual documents, you can set "expand.rows=0". Note that when using "expand.rows=0", score won’t be computed for the expanded section even when requested so maxScore will not be available. Review comment: Example ``` [IMPORTANT] When `expand.rows=0`, then only the number of documents found for each expanded value is returned. Hence, scores won't be computed even if requested. `maxScore` is set to 0 ``` 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org
[GitHub] [lucene-solr] munendrasn commented on a change in pull request #1334: SOLR-8306: Enhance ExpandComponent to allow expand.hits=0
munendrasn commented on a change in pull request #1334: SOLR-8306: Enhance ExpandComponent to allow expand.hits=0 URL: https://github.com/apache/lucene-solr/pull/1334#discussion_r393126595 ## File path: solr/solr-ref-guide/src/collapse-and-expand-results.adoc ## @@ -142,6 +142,8 @@ The “expand=true” parameter turns on the ExpandComponent. The ExpandComponen Inside the expanded section there is a _map_ with each group head pointing to the expanded documents that are within the group. As applications iterate the main collapsed result set, they can access the _expanded_ map to retrieve the expanded groups. +If you would like to have only the number of documents found from the groups in the expanded section returned and not the actual documents, you can set "expand.rows=0". Note that when using "expand.rows=0", score won’t be computed for the expanded section even when requested so maxScore will not be available. Review comment: Thanks for the documentation update. I think this should be part of `expand.rows=0`. Something like this https://github.com/apache/lucene-solr/pull/1334/files#diff-9c5999131702feec07a6b7057fa3bcd7R23 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org
[GitHub] [lucene-solr] munendrasn commented on a change in pull request #1334: SOLR-8306: Enhance ExpandComponent to allow expand.hits=0
munendrasn commented on a change in pull request #1334: SOLR-8306: Enhance ExpandComponent to allow expand.hits=0 URL: https://github.com/apache/lucene-solr/pull/1334#discussion_r393125271 ## File path: solr/CHANGES.txt ## @@ -57,7 +57,7 @@ Improvements Optimizations - -(No changes) +* SOLR-8306: Enhance ExpandComponent to allow expand.hits=0 (Marshall Sanders, Amelia Henderson) Review comment: Maybe change the wording here, something like `Do not collect expand documents when expand.rows=0` there is no `expand.hits` parameter 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org
[GitHub] [lucene-solr] munendrasn commented on a change in pull request #1334: SOLR-8306: Enhance ExpandComponent to allow expand.hits=0
munendrasn commented on a change in pull request #1334: SOLR-8306: Enhance ExpandComponent to allow expand.hits=0 URL: https://github.com/apache/lucene-solr/pull/1334#discussion_r392043206 ## File path: solr/core/src/java/org/apache/solr/handler/component/ExpandComponent.java ## @@ -420,37 +421,48 @@ public void process(ResponseBuilder rb) throws IOException { CharsRefBuilder charsRef = new CharsRefBuilder(); for (LongObjectCursor cursor : groups) { long groupValue = cursor.key; - TopDocsCollector topDocsCollector = TopDocsCollector.class.cast(cursor.value); - TopDocs topDocs = topDocsCollector.topDocs(); - ScoreDoc[] scoreDocs = topDocs.scoreDocs; - if (scoreDocs.length > 0) { -if (returnFields.wantsScore() && sort != null) { - TopFieldCollector.populateScores(scoreDocs, searcher, query); -} -int[] docs = new int[scoreDocs.length]; -float[] scores = new float[scoreDocs.length]; -for (int i = 0; i < docs.length; i++) { - ScoreDoc scoreDoc = scoreDocs[i]; - docs[i] = scoreDoc.doc; - scores[i] = scoreDoc.score; + if (cursor.value instanceof TopDocsCollector) { +TopDocsCollector topDocsCollector = TopDocsCollector.class.cast(cursor.value); +TopDocs topDocs = topDocsCollector.topDocs(); +ScoreDoc[] scoreDocs = topDocs.scoreDocs; +if (scoreDocs.length > 0) { + if (returnFields.wantsScore() && sort != null) { +TopFieldCollector.populateScores(scoreDocs, searcher, query); + } + int[] docs = new int[scoreDocs.length]; + float[] scores = new float[scoreDocs.length]; + for (int i = 0; i < docs.length; i++) { +ScoreDoc scoreDoc = scoreDocs[i]; +docs[i] = scoreDoc.doc; +scores[i] = scoreDoc.score; + } + assert topDocs.totalHits.relation == TotalHits.Relation.EQUAL_TO; + DocSlice slice = new DocSlice(0, docs.length, docs, scores, topDocs.totalHits.value, Float.NaN); + addGroupSliceToOutputMap(fieldType, ordBytes, outMap, charsRef, groupValue, slice); } -assert topDocs.totalHits.relation == TotalHits.Relation.EQUAL_TO; -DocSlice slice = new DocSlice(0, docs.length, docs, scores, topDocs.totalHits.value, Float.NaN); - -if(fieldType instanceof StrField) { - final BytesRef bytesRef = ordBytes.get((int)groupValue); - fieldType.indexedToReadable(bytesRef, charsRef); - String group = charsRef.toString(); - outMap.add(group, slice); -} else { - outMap.add(numericToString(fieldType, groupValue), slice); + } else { +int totalHits = ((TotalHitCountCollector) cursor.value).getTotalHits(); +if (totalHits > 0) { + DocSlice slice = new DocSlice(0, 0, null, null, totalHits, 0); Review comment: Here, maxScore is always 0 even if score is requested and I think this needs to be documented 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org
[GitHub] [lucene-solr] munendrasn commented on a change in pull request #1334: SOLR-8306: Enhance ExpandComponent to allow expand.hits=0
munendrasn commented on a change in pull request #1334: SOLR-8306: Enhance ExpandComponent to allow expand.hits=0 URL: https://github.com/apache/lucene-solr/pull/1334#discussion_r392044537 ## File path: solr/core/src/test/org/apache/solr/handler/component/DistributedExpandComponentTest.java ## @@ -153,6 +153,23 @@ public void test() throws Exception { assertExpandGroupCountAndOrder("group3", 1, results, "9"); assertExpandGroupCountAndOrder("group4", 1, results, "14"); +//Test expand.rows = 0 - no docs only expand count + +params = new ModifiableSolrParams(); Review comment: Is it possible to add a case w/o collapse too (with expand.field) and with fl with and w/o `score`? 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org
[GitHub] [lucene-solr] munendrasn commented on a change in pull request #1334: SOLR-8306: Enhance ExpandComponent to allow expand.hits=0
munendrasn commented on a change in pull request #1334: SOLR-8306: Enhance ExpandComponent to allow expand.hits=0 URL: https://github.com/apache/lucene-solr/pull/1334#discussion_r392042877 ## File path: solr/CHANGES.txt ## @@ -114,6 +114,8 @@ Improvements * SOLR-13965: In GraphHandler, support configuration and deprecate configuration. (Eric Pugh via Christine Poerschke) +* SOLR-8306: Enhance ExpandComponent to allow expand.hits=0 (Marshall Sanders, Amelia Henderson) Review comment: This should be in 8.6 probably in optimization section 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org
[GitHub] [lucene-solr] munendrasn commented on a change in pull request #1334: SOLR-8306: Enhance ExpandComponent to allow expand.hits=0
munendrasn commented on a change in pull request #1334: SOLR-8306: Enhance ExpandComponent to allow expand.hits=0 URL: https://github.com/apache/lucene-solr/pull/1334#discussion_r392044626 ## File path: solr/core/src/test/org/apache/solr/handler/component/TestExpandComponent.java ## @@ -234,6 +234,21 @@ private void _testExpand(String group, String floatAppend, String hint) throws E "/response/lst[@name='expanded']/result[@name='2"+floatAppend+"']/doc[1]/str[@name='id'][.='8']" ); +//Test expand.rows = 0 - no docs only expand count +params = new ModifiableSolrParams(); Review comment: Same as above so that we can cover more cases 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org
[GitHub] [lucene-solr] munendrasn commented on a change in pull request #1334: SOLR-8306: Enhance ExpandComponent to allow expand.hits=0
munendrasn commented on a change in pull request #1334: SOLR-8306: Enhance ExpandComponent to allow expand.hits=0 URL: https://github.com/apache/lucene-solr/pull/1334#discussion_r392043916 ## File path: solr/core/src/java/org/apache/solr/handler/component/ExpandComponent.java ## @@ -668,6 +676,18 @@ public void collect(int docId) throws IOException { } + private static Collector getExpandCollector(int limit, Sort sort) throws IOException { Review comment: I think this method should be part of `GroupCollector` (default implementation) and method name could simply be `getCollector` 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org
[GitHub] [lucene-solr] munendrasn commented on a change in pull request #1334: SOLR-8306: Enhance ExpandComponent to allow expand.hits=0
munendrasn commented on a change in pull request #1334: SOLR-8306: Enhance ExpandComponent to allow expand.hits=0 URL: https://github.com/apache/lucene-solr/pull/1334#discussion_r392043974 ## File path: solr/core/src/java/org/apache/solr/search/DocSlice.java ## @@ -56,7 +56,7 @@ public DocSlice(int offset, int len, int[] docs, float[] scores, long matches, f this.scores=scores; this.matches=matches; this.maxScore=maxScore; -this.ramBytesUsed = BASE_RAM_BYTES_USED + ((long)docs.length << 2) + (scores == null ? 0 : ((long)scores.length<<2)+RamUsageEstimator.NUM_BYTES_ARRAY_HEADER); +this.ramBytesUsed = BASE_RAM_BYTES_USED + (docs == null ? 0 : ((long)docs.length << 2)) + (scores == null ? 0 : ((long)scores.length<<2)+RamUsageEstimator.NUM_BYTES_ARRAY_HEADER); Review comment: 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org