[opencms-dev] Solr sorting issue
Thorsten Duhn
duhn at regio-gmbh.de
Wed Feb 12 10:08:47 CET 2014
Hello,
I'm still in trouble with sorting in Solr. Problem is that I am sorting
content types (like list-large and list-small examples in the bootstrap
example module) and I want to sort for title of the element. I created a
mapping from title in schema, so I can now see "sorttitle_de_s" in Solr
index and sort for that. Unfortunally this is still case sensitive (big
letters first), but that is the smaller problem. For specific contents I
need some possibility to add manual sorting values. So f.i. that one
entry is shown first. In other cases special characters like quotation
marks should be ignored (without changing Title).
So it came to my mind that an additional field like "sortname" could be
helpful, so in such specific cases a different text is used for sort.
But for migration and future editing reasons this should not be
required, but optional. Always copying title to sortname by hand for
every entry is not useful. So two ideas came to my mind:
1. Schema could have some default setting so that saving content fills
sortname field with title content, if there is no content already.
2. Solr query could be written in a way, that it uses the sortname field
only if it is filled, otherwise it uses the mapped title ("sorttitle_de_s").
Both ideas did not succeed. I have not seen how to implement such a
default mechanism in schema and for Solr I found no solution as well.
Comma-separating several fields in query does not work as it assumes
empty for "sorttitle" and gives all items with set sorttitle first, and
the rest afterwards. Trying FunctionQuery (f.i. "sort=def(sortname_de_s,
sorttitle_de_s) asc") throws UnsupportedOperationException.
Thanks,
Thorsten
More information about the opencms-dev
mailing list