use of com.qlangtech.tis.runtime.module.misc.VisualType in project tis by qlangtech.
the class ParseResult method serialTypes.
/**
* @param
* @throws JSONException
*/
@Override
public com.alibaba.fastjson.JSONArray serialTypes() {
com.alibaba.fastjson.JSONArray types = new com.alibaba.fastjson.JSONArray();
com.alibaba.fastjson.JSONObject f = null;
com.alibaba.fastjson.JSONArray tokens = null;
com.alibaba.fastjson.JSONObject tt = null;
SolrFieldsParser.SolrType solrType = null;
// Set<String> typesSet = new HashSet<String>();
for (Map.Entry<String, VisualType> t : TokenizerType.visualTypeMap.entrySet()) {
f = new com.alibaba.fastjson.JSONObject();
f.put("name", t.getKey());
f.put("split", t.getValue().isSplit());
tokens = new com.alibaba.fastjson.JSONArray();
if (t.getValue().isSplit()) {
// 默认类型
for (ISearchEngineTokenizerType tokenType : t.getValue().getTokenerTypes()) {
tt = new com.alibaba.fastjson.JSONObject();
tt.put("key", tokenType.getKey());
tt.put("value", tokenType.getDesc());
tokens.add(tt);
}
// 外加类型
for (Map.Entry<String, SolrFieldsParser.SolrType> entry : this.types.entrySet()) {
solrType = entry.getValue();
if (solrType.tokenizerable) {
tt = new com.alibaba.fastjson.JSONObject();
tt.put("key", entry.getKey());
tt.put("value", entry.getKey());
tokens.add(tt);
}
}
f.put("tokensType", tokens);
}
types.add(f);
}
for (Map.Entry<String, SolrFieldsParser.SolrType> entry : this.types.entrySet()) {
solrType = entry.getValue();
if (!solrType.tokenizerable && !TokenizerType.isContain(entry.getKey())) {
f = new com.alibaba.fastjson.JSONObject();
f.put("name", entry.getKey());
types.add(f);
}
}
// schema.put("fieldtypes", types);
return types;
}
Aggregations