there are more terms than documents in field "attr_quotes", but it's impossible to sort on tokenized fields
2010-06-10 16:01:43 [main] [org.apache.solr.core.SolrCore]-[ERROR] java.lang.RuntimeException: there are more terms than documents in field "attr_quotes", but it's impossible to sort on tokenized fields
at org.apache.lucene.search.FieldCacheImpl$StringIndexCache.createValue(FieldCacheImpl.java:706)
at org.apache.lucene.search.FieldCacheImpl$Cache.get(FieldCacheImpl.java:208)
at org.apache.lucen
attr_quotes asc
贴下引发异常的代码。由此证明 分词的field和 多值的field不能排序的。
protected Object createValue(IndexReader reader, Entry entryKey)
throws IOException {
String field = StringHelper.intern(entryKey.field);
final int[] retArray = new int[reader.maxDoc()];
String[] mterms = new String[reader.maxDoc()+1];
TermDocs termDocs = reader.termDocs();
TermEnum termEnum = reader.terms (new Term (field));
int t = 0; // current term number
// an entry for documents that have no terms in this field
// should a document with no terms be at top or bottom?
// this puts them at the top - if it is changed, FieldDocSortedHitQueue
// needs to change as well.
mterms[t++] = null;
try {
do {
Term term = termEnum.term();
if (term==null || term.field() != field) break;
// store term text
// we expect that there is at most one term per document
if (t >= mterms.length) throw new RuntimeException ("there are more terms than " +
"documents in field \"" + field + "\", but it's impossible to sort on " +
"tokenized fields");
mterms[t] = term.text();
termDocs.seek (termEnum);
while (termDocs.next()) {
retArray[termDocs.doc()] = t;
}
t++;
} while (termEnum.next());
} finally {
termDocs.close();
termEnum.close();
}
if (t == 0) {
// if there are no terms, make the term array
// have a single null entry
mterms = new String[1];
} else if (t < mterms.length) {
// if there are less terms than documents,
// trim off the dead array space
String[] terms = new String[t];
System.arraycopy (mterms, 0, terms, 0, t);
mterms = terms;
}
StringIndex value = new StringIndex (retArray, mterms);
return value;
}
};
分享到:
相关推荐
基于solr-geo空间搜索 1、Solr的schema.xml配置 定义坐标field 2、Solr的data-config.xml配置 建立索引 3、java查询语法 坐标距离、分页、排序
solr.warsolr.war包solr.war包solr.war包solr.war包solr.war包solr.war包solr.war包solr.war包solr.war包solr.war包solr.war包solr.war包solr.war包solr.war包solr.war包solr.war包solr.war包solr.war包solr.war包...
solr文档解说
solr
solr
solr文档
在本套课程中,我们将全面的讲解Solr,从Solr基础到Solr高级,再到项目实战,基本上涵盖了Solr中所有的知识点。 主讲内容 章节一:Solr基础(上) 1. 环境搭建 2. 核心讲解 3. 数据导入 4. 各种中文分析器 章节二:...
Solr reRank简介,用于描述solr二次排序的规则,Solr reRank简介,用于描述solr二次排序的规则
solr manageschema 配置文件,增加了分词器后的配置文件
solr技术文solr技术文solr技术文
Solr定时更新Solr定时更新
如何使用solr搭建服务器
Solr 依存于Lucene,因为Solr底层的核心技术是使用Lucene 来实现的,Solr和Lucene的本质区别有以下三点:搜索服务器,企业级和管理。Lucene本质上是搜索库,不是独立的应用程序,而Solr是。Lucene专注于搜索底层的...
通过solr实现电商搜索排名打分,排序,可自定义打分规则
3.6.2 排序 42 3.6.3 字段增加权重 42 3.6.4 Solr分词器、过滤器、分析器 42 3.6.5 Solr高亮使用 46 4 SolrJ的用法 46 4.1 搜索接口的调用实例 46 4.2 Solrj的使用说明 47 4.2.1 Adding Data to Solr 47 4.2.2 ...
Apache Solr(solr-8.11.1.tgz)Binary releases 二进制版本
solr增量更新-
solr安装包下载地址
Solr笔记,Solr笔记,Solr笔记,Solr笔记,Solr笔记,Solr笔记,Solr笔记,Solr笔记,Solr笔记,Solr笔记,
Solr(Cloudera)使用手册