This works fine for me in a current Solr (5x). What version are you using? Note that _any_ field you use for sorting _must_ be indexed="true" or, in recent Solrs, docValues="true", just like any other field. You can't sort on a field that only has stored='"true" which is the only bit of the field definition posted so far..
Best, Erick On Mon, Apr 25, 2016 at 6:13 AM, Torsten Krah <krah...@gmail.com> wrote: > Hi, > > unfortunately i did not and no one did answered to this yet - although > javadoc states it should work it does not. > In the meantime i've used my own custom field but still i am interested > on a solution to this. > > Lucene 6 still does have the same javadoc: > > https://lucene.apache.org/core/6_0_0/core/org/apache/lucene/document/StringField.html > > Cheers > > Torsten > > > Am Donnerstag, den 21.04.2016, 13:13 +0530 schrieb Gimantha Bandara: >> Hi Torsten, >> >> >> Did you find a solution for this? I am having the same issue.. I am >> planning to create a custom Field with DocValueType.SORTED. Is there >> any other way to do that without creating a custom Field? >> >> >> On Fri, Mar 6, 2015 at 3:34 PM, Torsten Krah <krah...@gmail.com> >> wrote: >> Hi, >> >> looking at the JavaDoc of StringField it says: >> >> /** A field that is indexed but not tokenized: the entire >> * String value is indexed as a single token. For example >> * this might be used for a 'country' field or an 'id' >> * field, or any field that you intend to use for sorting >> * or access through the field cache. */ >> >> So i intend to use some StringFields for sorting. >> However trying to sort on them fails with: >> >> java.lang.IllegalStateException: unexpected docvalues type >> NONE for >> field 'NAME_KEYWORD' (expected=SORTED). >> >> Was indexed as StringField and Store.YES. >> >> So is the JavaDoc wrong here or is it correct and StringField >> should >> set: >> >> TYPE.setDocValuesType(DocValuesType.SORTED); >> >> so it would work? >> >> kind regards >> >> Torsten >> >> >> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: >> java-user-unsubscr...@lucene.apache.org >> For additional commands, e-mail: >> java-user-h...@lucene.apache.org >> >> >> >> >> -- >> Gimantha Bandara >> Software Engineer >> WSO2. Inc : http://wso2.com >> Mobile : +94714961919 > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org