I have the following xml that indexed in solr:
<doc>
<field name="title" type="text_general" class="solr.TextField" indexed="true" stored="true" required="true" multiValued="false" >Sharknado 3</field>
<field name="author">moriarti</field>
<field name="price">20.5</field>
</doc>
<doc>
<field name="title" type="text_general" class="solr.TextField" indexed="true" stored="true" required="true" multiValued="false" >Sharknado</field>
<field name="author">moriarti</field>
<field name="price">18</field>
</doc>
<doc>
<field name="title" type="text_general" class="solr.TextField" indexed="true" stored="true" required="true" multiValued="false" >Sharknado 2</field>
<field name="author">moriarti</field>
<field name="price">19.5</field>
</doc>
The next problem I have is that when I do a deep paging, it forces me to sort by id asc or id desc and then I can not sort by "title". I have tried to use the default search field (df), but the result is still wrong. Would you know how I can solve it, so that I can order by title?
Finally I have solved it, After investigating a little about the tokenizers and trying several things...
First: I modified the solrconfig.xml to be able to edit it manually. I added:
<schemaFactory class="ManagedIndexSchemaFactory">
<bool name="mutable">true</bool>
<str name="managedSchemaResourceName">managed-schema</str>
</schemaFactory>
as indicated here.
Second: I changed in manage-schema.xml the following for my field:
<field name="title" type="text_general" multiValued="false" indexed="true" stored="true"/>
Third: I ordered by score and by title, in the following way in solrj:
query.addSort("score", ORDER.desc);
query.addSort("title", ORDER.asc);
query.addSort("id", ORDER.desc);
I also have as parameter in solrj:
query.setParam ("df", "title");
In this way, it returns the results correctly. Thanks for your time MatsLindh.