code: private List<Facet> buildFacetsFromObject(@NotNull Object document) {
          List<Facet> facets = new ArrayList<>();
  
          for (Field field : document.getClass().getDeclaredFields()) {
              if (isFacetField(field)) {
                  Object fieldValue = getFieldValue(document, field);
  
                  if (fieldValue != null) {
                      List<Serializable> values = transformValue(fieldValue);
  
                      values.forEach(value -> {
                          Facet key = new Facet(new FacetType(field.getName(), value.getClass()), value);
  
                          facets.add(key);
                      });
                  }
              }
          }
  
          return facets;
      }
docs: Build facets from document object by extracting all fields and values
  
  @param document Document object
  
  @return List of facets