1

I am using solr for querying of fields with single characters and wild card searching.

For example I am looking to return an object that has names like "A", "AA", "AB", "BZ^A", "AAB".

If I create a query of q=name:a&sort=name+asc

I get an unexpected result of "A", "BZ^A", "AA" and so on.

Ive also tried q=name:a* and the result set is the same.

Is there a way to get the expect sorted result of "A", "AA", "AAB", "AB", "BZ^A"?

Here is my field type/name information from the xml file.

<schema name="solr_quickstart" version="1.1">
  <types>
    <fieldType name="text" class="solr.TextField">
      <analyzer>
        <tokenizer class="solr.StandardTokenizerFactory" />
        <filter class="solr.LowerCaseFilterFactory" />
      </analyzer>
    </fieldType>
  </types>
  <fields>
    <field name="name" type="text" indexed="true" stored="true" />
  </fields>
   <defaultSearchField>name</defaultSearchField>
  <uniqueKey>(name)</uniqueKey>
</schema>
ckross01
  • 1,681
  • 2
  • 17
  • 26
  • Would you post the fieldType of the field name from your schema.xml? I assume that field is tokenized. When sorting tokenized fields interesting stuff can happen. – cheffe Dec 31 '14 at 05:42

1 Answers1

0

Take a look at this answer to a similar question. You're going to have problems sorting on Text fields that tokenize into multiple terms. You can still do it in this case by changing the analyzer to the keyword analyzer. If you still need multiple terms though, you'll want to copyField into another field.

Community
  • 1
  • 1
  • had the wrong field type there it should have been text, i updated the post to reflect that. Not sure if it changes your answer. – ckross01 Jan 06 '15 at 16:27