You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by PeterKerk <ve...@hotmail.com> on 2011/01/20 18:34:50 UTC

Showing facet values in alphabetical order

I want to provide a list of facets to my visitors order alphabetically, for
example, for the 'features' facet I have:

data-config.xml:
<entity name="location_feature" query="select featureid from
location_features where locationid='${location.id}'">
	<entity name="feature" query="select title from features where id =
'${location_feature.featureid}' ORDER BY title ASC">
		<field name="features" column="title" />
	</entity>
</entity>

schema.xml:
<field name="features" type="textTight" indexed="true" stored="true"
multiValued="true"/>
<field name="features_raw" type="string" indexed="true" stored="true"
multiValued="true"/>
<copyField source="features" dest="features_raw"/>


But this doesnt give me the facets in an alphabetical order.

Besides the features facet, I also have some other facets that ALSO need to
be shown in alphabetical order. How to approach this?
-- 
View this message in context: http://lucene.472066.n3.nabble.com/Showing-facet-values-in-alphabetical-order-tp2295301p2295301.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Showing facet values in alphabetical order

Posted by Jonathan Rochkind <ro...@jhu.edu>.
Are you showing the facets with &facet parameters in your request?

Then you can ask for the facets to be returned sorted by byte-order with 
facet.sort=index.

Got nothing to do with your schema, let alone your DIH import 
configuration that you showed us. Just a matter of how you ask Solr for 
facets.

Byte order is not neccesarily exactly  'alphabetical' order, if your 
facets are not 7-bit-ascii and/or if they contain punctuation. If your 
facet values are just 7-bit ascii characters and spaces, it should 
basically be alphabetical order.

But that's all that Solr offers, as far as I know.

On 1/20/2011 12:34 PM, PeterKerk wrote:
> I want to provide a list of facets to my visitors order alphabetically, for
> example, for the 'features' facet I have:
>
> data-config.xml:
> <entity name="location_feature" query="select featureid from
> location_features where locationid='${location.id}'">
> 	<entity name="feature" query="select title from features where id =
> '${location_feature.featureid}' ORDER BY title ASC">
> 		<field name="features" column="title" />
> 	</entity>
> </entity>
>
> schema.xml:
> <field name="features" type="textTight" indexed="true" stored="true"
> multiValued="true"/>
> <field name="features_raw" type="string" indexed="true" stored="true"
> multiValued="true"/>
> <copyField source="features" dest="features_raw"/>
>
>
> But this doesnt give me the facets in an alphabetical order.
>
> Besides the features facet, I also have some other facets that ALSO need to
> be shown in alphabetical order. How to approach this?

Re: Showing facet values in alphabetical order

Posted by Ahmet Arslan <io...@yahoo.com>.
> But this doesnt give me the facets in an alphabetical
> order.
> 
> Besides the features facet, I also have some other facets
> that ALSO need to
> be shown in alphabetical order. How to approach this?

&facet.sort=false 
http://wiki.apache.org/solr/SimpleFacetParameters#facet.sort