我有这些电子邮件:“jack@gmail.com”、“jack1@gmail.com”。我想对它们进行排序
Solr 将返回以下结果:
jack1@gmail.com
jack@gmail.com
我认为正确的排序结果应该是:
jack@gmail.com
jack1@gmail.com
像这样的配置:
<field name="email" type="string" indexed="true" stored="true"/>
任何人都可以帮忙吗?
以下是solr响应:
{ "responseHeader":{ "status":0, "QTime":0, "params":{ "sort":"advertiser_email_t asc", "indent":"true", "q":":", "wt":"json", "response":{"numFound":3,"start":0,"docs":[ { "advertiser_email_t":"ad111@qq.com", "id":"01df4dea-beb3-46fb-940b-78eda109503c" }, { "advertiser_email_t":"ad@qq.com", "id":"935de002-10e0-437f-a571-e74bb6646228" }, { "advertiser_email_t":"wang@qq.com", "id":"2a80935e-e520-4c3e-8d56-8e7b1096b372"}] } }
这是字段定义:
<dynamicField name="*_t" type="text_general" indexed="true" stored="true"/>
这是字段类型定义:
<fieldType name="text_general" class="solr.TextField" positionIncrementGap="100"> <分析器类型="索引"> <tokenizer class="solr.StandardTokenizerFactory"/> <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" /> <filter class="solr.LowerCaseFilterFactory"/> </分析仪> <分析器类型="查询"> <tokenizer class="solr.StandardTokenizerFactory"/> <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" /> <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/> <filter class="solr.LowerCaseFilterFactory"/> </分析仪> </fieldType>
将字段名称更改为“电子邮件”后:
{“responseHeader”:{“状态”:0,“QTime”:0,“参数”:{“排序”:“电子邮件asc”,“缩进”:“真”,“q”:“ : ”,“_ ": "1383822359034", "wt": "json" } }, "response": { "numFound": 2, "start": 0, "docs": [ { "email": "ad1@qq.com" , "id": "00000000-0000-0000-0000-000000000002" }, { "email": "ad@qq.com", "id": "00000000-0000-0000-0000-000000000001" } ] } }