[ 
https://issues.apache.org/jira/browse/LUCENE-9444?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17198780#comment-17198780
 ] 

Ankur edited comment on LUCENE-9444 at 9/19/20, 6:30 PM:
---------------------------------------------------------

Thanks [~mikemccand] for making those changes. I made a couple of minor edits 
to _TaxonomyFacetLabels.java_
 * Removed the reference to \{@link java.util.Iterator} as it is no longer used.
 * Fixed typo in javadoc.
 * Replaced 
{code:java}
 if (parentOrd == INVALID_ORDINAL) {
        throw new AssertionError("Root ordinal not found for facet dimension: " 
+ facetDimension);
  }{code}
with single line
{code:java}
assert parentOrd != INVALID_ORDINAL : "Category ordinal not found for facet 
dimension: " + facetDimension; {code}
 in method
{code:java}
public FacetLabel nextFacetLabel(int docId, String facetDimension) throws 
IOException{code}

 * Created a pull request as you suggested in one of your earlier comments :)
 ** 
[https://github.com/apache/lucene-solr/pull/1893/commits/bf8eaf98901cbe83f23067bea90dfb2f3102603a]

Can you take a look and see if it's ready to be committed ?


was (Author: goankur):
Thanks [~mikemccand] for making those changes. I made a couple of minor edits
 * Fixed typo in javadoc
 * Replaced 
{code:java}
 if (parentOrd == INVALID_ORDINAL) {
        throw new AssertionError("Root ordinal not found for facet dimension: " 
+ facetDimension);
  }{code}
with single line
{code:java}
assert parentOrd != INVALID_ORDINAL : "Category ordinal not found for facet 
dimension: " + facetDimension; {code}
 in method
{code:java}
public FacetLabel nextFacetLabel(int docId, String facetDimension) throws 
IOException{code}

 * Created a pull request as you suggested in one of your earlier comments :)
 ** 
[https://github.com/apache/lucene-solr/pull/1893/commits/bf8eaf98901cbe83f23067bea90dfb2f3102603a]

Can you take a look and see  if it's ready to be committed ?

> Need an API to easily fetch facet labels for a field in a document
> ------------------------------------------------------------------
>
>                 Key: LUCENE-9444
>                 URL: https://issues.apache.org/jira/browse/LUCENE-9444
>             Project: Lucene - Core
>          Issue Type: Improvement
>          Components: modules/facet
>    Affects Versions: 8.6
>            Reporter: Ankur
>            Priority: Major
>              Labels: facet
>         Attachments: LUCENE-9444.patch, LUCENE-9444.patch, 
> LUCENE-9444.v2.patch
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> A facet field may be included in the list of fields whose values are to be 
> returned for each hit.
> In order to get the facet labels for each hit we need to
>  # Create an instance of _DocValuesOrdinalsReader_ and invoke 
> _getReader(LeafReaderContext context)_ method to obtain an instance of 
> _OrdinalsSegmentReader()_
>  # _OrdinalsSegmentReader.get(int docID, IntsRef ordinals)_ method is then 
> used to fetch and decode the binary payload in the document's BinaryDocValues 
> field. This provides the ordinals that refer to facet labels in the 
> taxonomy.**
>  # Lastly TaxonomyReader.getPath(ord) is used to fetch the labels to be 
> returned.
>  
> Ideally there should be a simple API - *String[] getLabels(docId)* that hides 
> all the above details and gives us the string labels. This can be part of 
> *TaxonomyFacets* but that's just one idea.
> I am opening this issue to get community feedback and suggestions.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to