How to sort a fieldindex case insensitive

By default FieldIndexes work case sensitive. I. e. that if you search the catalog with a construct like:

     meta_type = 'someType',
     sort_on = 'someIndex'

the results are sorted case sensitive on someIndex.

For case insensitive sorting two options are possible:


To quote from the authors website : ManagableIndex can mean different things for different people. For a content manager, it brings flexible field, keyword and efficient range indexes managable via the ZMI…

For case insensitive sorting the following configuration steps are necessary:

  • In the ZMI go to your plone instance
  • Select portal_catalog > indexes
  • Replace the index for which you want case insensitive sorting with a ManagableFieldIndex
  • select the index and go to properties
  • for term prenormalizer add: “python: value.lower()”
  • go back to the index and select the “indexName(Name:…) link
  • For the normalizer add: “python: value.lower()”
  • In portal_catalog > indexes select the index and reindex the content

Now in this index all objects are stored in lowercase. I. e. that all sort operations work case insensitive.


Without customization the catalogue takes the valaue of an attribute and stores it in the catalog unchangend. For each index in the catalog the attribute or method to catalogue can be defined. So, if you want case insensitive sorting for a certain content type define a method in the python declaration of this content type that returns the text of an attribute as lowercase and add an additional index where you set the indexable attribute to the method name.

Assume that you have a content type “myType” with an attribute “someAttr” and you would like to have case insensitive sorting on “someAttr”. What you do is as follows:

  • add a method “getSomeAttr” to the definition of “myType”
  • in the method return the attribute as lowercase e. g. with return someAttr.lower()
  • create an index “myIndex” and set the indexableAttribute to “getSomeAttr”