Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-9444

Need an API to easily fetch facet labels for a field in a document

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 8.6
    • Fix Version/s: None
    • Component/s: modules/facet
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      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

      1. Create an instance of DocValuesOrdinalsReader and invoke getReader(LeafReaderContext context) method to obtain an instance of OrdinalsSegmentReader()
      2. 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.**
      3. 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.

       

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              goankur Ankur
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: