Sort on text fields does not work when there are capital alphabets and/or 
spaces 
---------------------------------------------------------------------------------

                 Key: SOLR-372
                 URL: https://issues.apache.org/jira/browse/SOLR-372
             Project: Solr
          Issue Type: Bug
    Affects Versions: 1.2
         Environment: OS : Linux (Ubuntu Feisty)

            Reporter: Kapil Narula


Given a text field say 'author_t', solr does not sort it properly.
E.g.
when there are following 3 authors in index, 
Ayn Rand
Capra
Dan Brown

on giving 
http://localhost:8982/solr/select?indent=on&version=2.2&q=type_t%3ABook+AND+%28a*+OR+c*+OR+d*%29&start=0&rows=10&fl=*%2Cscore&qt=standard&wt=standard&debugQuery=on&explainOther=&hl.fl=&sort=author_t%20asc

the following output is returned

<response>
−
        <lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">5</int>
−
        <lst name="params">
<str name="wt">standard</str>
<str name="rows">10</str>
<str name="start">0</str>
<str name="sort">author_t asc</str>
<str name="q">type_t:Book AND (a* OR c* OR d*)</str>
<str name="fl">*,score</str>
<str name="qt">standard</str>
<str name="version">2.2</str>
<str name="explainOther"/>
<str name="hl.fl"/>
<str name="indent">on</str>
<str name="debugQuery">on</str>
</lst>
</lst>
−
        <result name="response" numFound="3" start="0" maxScore="2.6540346">
−
        <doc>
<float name="score">2.3394115</float>
−
        <arr name="author_t">
<str>Capra</str>
</arr>
−
        <arr name="combined_t">
<str>Fountainhead #combined# Capra</str>
</arr>
−
        <arr name="id">
<str>Book:2</str>
</arr>
−
        <arr name="pk_i">
<int>2</int>
</arr>
−
        <arr name="title_t">
<str>Fountainhead</str>
</arr>
−
        <arr name="type_t">
<str>Book</str>
</arr>
</doc>
−
        <doc>
<float name="score">2.6540346</float>
−
        <arr name="author_t">
<str>Dan Brown</str>
</arr>
−
        <arr name="combined_t">
<str>The Da Vinci Code #combined# Dan Brown</str>
</arr>
−
        <arr name="id">
<str>Book:3</str>
</arr>
−
        <arr name="pk_i">
<int>3</int>
</arr>
−
        <arr name="title_t">
<str>The Da Vinci Code</str>
</arr>
−
        <arr name="type_t">
<str>Book</str>
</arr>
</doc>
−
        <doc>
<float name="score">2.6540346</float>
−
        <arr name="author_t">
<str>Ayn Rand</str>
</arr>
−
        <arr name="combined_t">
<str>Tao of Physics #combined# Ayn Rand</str>
</arr>
−
        <arr name="id">
<str>Book:1</str>
</arr>
−
        <arr name="pk_i">
<int>1</int>
</arr>
−
        <arr name="title_t">
<str>Tao of Physics</str>
</arr>
−
        <arr name="type_t">
<str>Book</str>
</arr>
</doc>
</result>
−
        <lst name="debug">
<str name="rawquerystring">type_t:Book AND (a* OR c* OR d*)</str>
<str name="querystring">type_t:Book AND (a* OR c* OR d*)</str>
<str name="parsedquery">+type_t:book +(text:a* text:c* text:d*)</str>
<str name="parsedquery_toString">+type_t:book +(text:a* text:c* text:d*)</str>
−
        <lst name="explain">
−
        <str name="id=Book:2,internal_docid=35">

2.3394115 = (MATCH) sum of:
  2.2345371 = (MATCH) weight(type_t:book in 35), product of:
    0.83847296 = queryWeight(type_t:book), product of:
      2.6650078 = idf(docFreq=6)
      0.3146231 = queryNorm
    2.6650078 = (MATCH) fieldWeight(type_t:book in 35), product of:
      1.0 = tf(termFreq(type_t:book)=1)
      2.6650078 = idf(docFreq=6)
      1.0 = fieldNorm(field=type_t, doc=35)
  0.104874365 = (MATCH) product of:
    0.3146231 = (MATCH) sum of:
      0.3146231 = (MATCH) ConstantScoreQuery([EMAIL PROTECTED]), product of:
        1.0 = boost
        0.3146231 = queryNorm
    0.33333334 = coord(1/3)
</str>
−
        <str name="id=Book:3,internal_docid=36">

2.6540346 = (MATCH) sum of:
  2.2345371 = (MATCH) weight(type_t:book in 36), product of:
    0.83847296 = queryWeight(type_t:book), product of:
      2.6650078 = idf(docFreq=6)
      0.3146231 = queryNorm
    2.6650078 = (MATCH) fieldWeight(type_t:book in 36), product of:
      1.0 = tf(termFreq(type_t:book)=1)
      2.6650078 = idf(docFreq=6)
      1.0 = fieldNorm(field=type_t, doc=36)
  0.41949746 = (MATCH) product of:
    0.6292462 = (MATCH) sum of:
      0.3146231 = (MATCH) ConstantScoreQuery([EMAIL PROTECTED]), product of:
        1.0 = boost
        0.3146231 = queryNorm
      0.3146231 = (MATCH) ConstantScoreQuery([EMAIL PROTECTED]), product of:
        1.0 = boost
        0.3146231 = queryNorm
    0.6666667 = coord(2/3)
</str>
−
        <str name="id=Book:1,internal_docid=34">

2.6540346 = (MATCH) sum of:
  2.2345371 = (MATCH) weight(type_t:book in 34), product of:
    0.83847296 = queryWeight(type_t:book), product of:
      2.6650078 = idf(docFreq=6)
      0.3146231 = queryNorm
    2.6650078 = (MATCH) fieldWeight(type_t:book in 34), product of:
      1.0 = tf(termFreq(type_t:book)=1)
      2.6650078 = idf(docFreq=6)
      1.0 = fieldNorm(field=type_t, doc=34)
  0.41949746 = (MATCH) product of:
    0.6292462 = (MATCH) sum of:
      0.3146231 = (MATCH) ConstantScoreQuery([EMAIL PROTECTED]), product of:
        1.0 = boost
        0.3146231 = queryNorm
      0.3146231 = (MATCH) ConstantScoreQuery([EMAIL PROTECTED]), product of:
        1.0 = boost
        0.3146231 = queryNorm
    0.6666667 = coord(2/3)
</str>
</lst>
</lst>
</response>

As can be seen above the authors are not sorted properly.

However, if the authors names are changed to the following, sort happens 
properly

aynrand
capra
danbrown

This is a severe break in the functionality and I would recommend fixing it on 
a high priority basis.

Please let me know if you have any questions. 






-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to