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

Shai Erera commented on LUCENE-5370:
------------------------------------

bq. For my purpose, it's sufficient to sort facet after compute the top-n 
facets by weigth

You can then sort the LabelAndValues[] by their label part.

{quote}
Btw. I'm currently experimenting with a similar approach where we have 
facetlabels that are effectively numbers (like currency). Because I do not know 
on beforehand what will be in the facets, I put the String representation in 
the FacetLabel and store the numberic value in the Float part of a 
FloatAssociatedFacetField. Facets then can be sorted on the FloatAssociated 
value, which should be faster than retrieving labels from the reader.
{quote}

Do you have a unique value per document? If so, you should consider indexing 
the values in a NumericDocValues field (not go through the taxonomy at all and 
FacetsConfig) and then you can use the facet module's range faceting for 
example.

> Sorting Facets on CategoryPath (Label)
> --------------------------------------
>
>                 Key: LUCENE-5370
>                 URL: https://issues.apache.org/jira/browse/LUCENE-5370
>             Project: Lucene - Core
>          Issue Type: New Feature
>          Components: modules/facet
>    Affects Versions: 4.6
>            Reporter: Rob Audenaerde
>              Labels: features
>
> Facet support sorting through {{FacetRequest.SortOrder}}. This is used in the 
> {{ResultSortUtils}}. For my application it would be very nice if the facets 
> can also be sorted on their label. 
> I think this could be accomplished by altering {{FacetRequest}} with an extra 
> enum {{SortType}}, and two extra {{Heap}}  in {{ResultSortUtils}} which 
> instead of comparing the double value, compare the CategoryPath.
> What do you think of this idea? Or could the same behaviour be accomplished 
> in a different way already?
> (btw: I tried building this patch on the trunk of lucene5.0; but I couldn't 
> get the maven build to build correctly. I will try again lateron on the 4.6 
> branch.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

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

Reply via email to