Sure <fieldtype name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/>
The strange thing is that I could sort by another fields that is defined using string, but not by another defined as some tokenized field and after that copied as string. I attach the schema.xml for the case is there another error and the error log says the following INFO: UnInverted multi-valued field {field=date,memSize=70356,tindexSize=40,time=381,phase1=381,nTerms=99,bigTerms=5,termInstances=4330,uses=0} 11/08/2009 12:42:31 org.apache.solr.request.UnInvertedField uninvert INFO: UnInverted multi-valued field {field=local_medium,memSize=70088,tindexSize=56,time=10,phase1=10,nTerms=30,bigTerms=2,termInstances=2461,uses=0} 11/08/2009 12:42:31 org.apache.solr.core.SolrCore execute INFO: [] webapp=/solr path=/select params={rows=20&wt=json&facet.field=contributorfacet&facet.field=subjectfacet&facet.field=provenance&facet.field=local_state&facet.field=date&facet.field=local_medium&facet.limit=15&q=text:fisica&start=0&facet.mincount=1&fl=id,title,contributor,subject,provenance,date,coverage,publisher,score,local_state,local_url&sort=score+desc&facet=true} hits=312 status=0 QTime=4963 11/08/2009 12:51:46 org.apache.solr.core.SolrCore execute *** This is the order by date desc that is working OK and it's defined as string INFO: [] webapp=/solr path=/select params={rows=20&wt=json&q=text:fisica&start=0&sort=date+desc&fl=id,title,contributor,subject,provenance,date,coverage,publisher,score,local_state,local_url} hits=312 status=0 QTime=174 11/08/2009 12:52:38 org.apache.solr.common.SolrException log GRAVE: java.lang.RuntimeException: there are more terms than documents in field "contributororder", but it's impossible to sort on tokenized fields at org.apache.lucene.search.FieldCacheImpl$8.createValue(FieldCacheImpl.java:518) at org.apache.lucene.search.FieldCacheImpl$Cache.get(FieldCacheImpl.java:81) at org.apache.lucene.search.FieldCacheImpl.getStringIndex(FieldCacheImpl.java:491) at org.apache.solr.search.MissingLastOrdComparator.setNextReader(MissingStringLastComparatorSource.java:181) at org.apache.lucene.search.TopFieldCollector$OneComparatorNonScoringCollector.setNextReader(TopFieldCollector.java:92) at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:242) at org.apache.lucene.search.Searcher.search(Searcher.java:173) at org.apache.solr.search.SolrIndexSearcher.getDocListNC(SolrIndexSearcher.java:988) at Thanks a lot German On Tue, Aug 11, 2009 at 1:56 AM, Avlesh Singh<avl...@gmail.com> wrote: > Can you please post the fieldType definition for the "string" field in your > schema.xml? > > Cheers > Avlesh > > On Tue, Aug 11, 2009 at 9:52 AM, Germán Biozzoli > <germanbiozz...@gmail.com>wrote: > >> Hello everybody >> >> I have the following (resumed) schema: >> >> .... >> <field name="title" type="text" indexed="true" stored="true" >> multiValued="true"/> >> <field name="titleorder" type="string" indexed="true" stored="true" >> multiValued="true"/> >> <field name="contributor" type="text" indexed="true" stored="true" >> multiValued="true"/> >> <field name="contributorfacet" type="textFacetN" indexed="true" >> stored="true" multiValued="true"/> >> <field name="contributororder" type="string" indexed="true" >> stored="true" multiValued="true"/> >> ..... >> .... >> <copyField source="title" dest="text" /> >> <copyField source="title" dest="titleorder" /> >> <copyField source="contributor" dest="text" /> >> <copyField source="contributor" dest="contributorfacet" /> >> <copyField source="contributor" dest="contributororder" /> >> ... >> >> I use for instance contributor for searching, contributorfacet for >> faceting and order for ordering results, but when I try to order using >> contributororder, Solr says that cannot order by a tokenized >> field...(?) >> >> I'm using Solr 1.4 nightly. Is this a bug? I believe that in previous >> versions I have this issue working... >> >> Regards and thanks >> Germán >> >
<?xml version="1.0" encoding="UTF-8" ?> <schema name="Test" version="1.1"> <types> <fieldtype name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/> <fieldtype name="boolean" class="solr.BoolField" sortMissingLast="true" omitNorms="true"/> <fieldtype name="integer" class="solr.IntField" omitNorms="true"/> <fieldtype name="long" class="solr.LongField" omitNorms="true"/> <fieldtype name="float" class="solr.FloatField" omitNorms="true"/> <fieldtype name="double" class="solr.DoubleField" omitNorms="true"/> <fieldtype name="sint" class="solr.SortableIntField" sortMissingLast="true" omitNorms="true"/> <fieldtype name="slong" class="solr.SortableLongField" sortMissingLast="true" omitNorms="true"/> <fieldtype name="sfloat" class="solr.SortableFloatField" sortMissingLast="true" omitNorms="true"/> <fieldtype name="sdouble" class="solr.SortableDoubleField" sortMissingLast="true" omitNorms="true"/> <fieldtype name="date" class="solr.DateField" sortMissingLast="true" omitNorms="true"/> <fieldtype name="text_ws" class="solr.TextField" positionIncrementGap="100"> <analyzer> <tokenizer class="solr.WhitespaceTokenizerFactory"/> </analyzer> </fieldtype> <fieldtype name="text" class="solr.TextField" positionIncrementGap="100"> <analyzer type="index"> <tokenizer class="solr.WhitespaceTokenizerFactory"/> <filter class="solr.ISOLatin1AccentFilterFactory"/> <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/> <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0"/> <filter class="solr.LowerCaseFilterFactory"/> <filter class="solr.EnglishPorterFilterFactory" protected="protwords.txt"/> <filter class="solr.RemoveDuplicatesTokenFilterFactory"/> </analyzer> <analyzer type="query"> <tokenizer class="solr.WhitespaceTokenizerFactory"/> <filter class="solr.ISOLatin1AccentFilterFactory"/> <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/> <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/> <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0"/> <filter class="solr.LowerCaseFilterFactory"/> <filter class="solr.EnglishPorterFilterFactory" protected="protwords.txt"/> <filter class="solr.RemoveDuplicatesTokenFilterFactory"/> </analyzer> </fieldtype> <fieldtype name="textSpell" class="solr.TextField" positionIncrementGap="100" > <analyzer> <tokenizer class="solr.WhitespaceTokenizerFactory"/> <filter class="solr.ISOLatin1AccentFilterFactory"/> <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/> <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0"/> <filter class="solr.LowerCaseFilterFactory"/> <filter class="solr.RemoveDuplicatesTokenFilterFactory"/> </analyzer> </fieldtype> <fieldtype name="textFacetU" class="solr.TextField" positionIncrementGap="100" > <analyzer> <tokenizer class="solr.KeywordTokenizerFactory"/> <filter class="solr.ISOLatin1AccentFilterFactory"/> <filter class="solr.LowerCaseFilterFactory"/> <filter class="solr.RemoveDuplicatesTokenFilterFactory"/> </analyzer> </fieldtype> <fieldtype name="textFacetN" class="solr.TextField" positionIncrementGap="100" > <analyzer> <tokenizer class="solr.KeywordTokenizerFactory"/> <filter class="solr.ISOLatin1AccentFilterFactory"/> <filter class="solr.RemoveDuplicatesTokenFilterFactory"/> </analyzer> </fieldtype> </types> <fields> <!-- Core Fields --> <field name="id" type="string" indexed="true" stored="true" required="true"/> <field name="language" type="string" indexed="true" stored="true" multiValued="true"/> <field name="medium" type="string" indexed="true" stored="true" multiValued="true" /> <field name="title" type="text" indexed="true" stored="true" multiValued="true"/> <field name="titleorder" type="string" indexed="true" stored="true" multiValued="true"/> <field name="contributor" type="text" indexed="true" stored="true" multiValued="true"/> <field name="contributorfacet" type="textFacetN" indexed="true" stored="true" multiValued="true"/> <field name="contributororder" type="string" indexed="true" stored="true" multiValued="true"/> <field name="publisher" type="text" indexed="true" stored="true" multiValued="true"/> <field name="date" type="string" indexed="true" stored="true" multiValued="true"/> <field name="description" type="text" indexed="true" multiValued="true" stored="true"/> <field name="isbn" type="string" indexed="true" stored="true" multiValued="true"/> <field name="subject" type="text" indexed="true" stored="true" multiValued="true"/> <field name="subjectfacet" type="textFacetU" indexed="true" stored="true" multiValued="true"/> <field name="provenance" type="string" indexed="true" stored="true" multiValued="true"/> <field name="text" type="text" indexed="true" stored="false" multiValued="true"/> <field name="local_edition" type="string" indexed="false" stored="true" multiValued="true"/> <field name="local_url" type="string" indexed="false" stored="true" multiValued="true"/> <field name="local_other_identifier" type="string" indexed="true" stored="true" multiValued="true"/> <field name="local_state" type="string" indexed="true" stored="true"/> <field name="local_rights" type="string" indexed="true" stored="true" multiValued="true"/> <field name="local_date" type="string" indexed="true" stored="true" multiValued="true"/> <field name="local_medium" type="string" indexed="true" stored="true" multiValued="true"/> <field name="local_format" type="string" indexed="true" stored="true" multiValued="true"/> <field name="local_coverage" type="string" indexed="true" stored="true" multiValued="true"/> </fields> <uniqueKey>id</uniqueKey> <!--<defaultSearchField>allfields</defaultSearchField>--> <solrQueryParser defaultOperator="AND" /> <defaultSearchField>text</defaultSearchField> <!-- what gets searched by default --> <copyField source="title" dest="text" /> <copyField source="title" dest="titleorder" /> <copyField source="contributor" dest="text" /> <copyField source="contributor" dest="contributorfacet" /> <copyField source="contributor" dest="contributororder" /> <copyField source="subject" dest="text" /> <copyField source="subject" dest="subjectfacet" /> <copyField source="isbn" dest="text" /> <copyField source="description" dest="text" /> <copyField source="publisher" dest="text" /> <copyField source="local_medium" dest="text" /> </schema>