Search in sources :

Example 1 with TokenizerType

use of com.qlangtech.tis.runtime.module.misc.TokenizerType in project tis by qlangtech.

the class PSchemaField method serialVisualType2Json.

@Override
public void serialVisualType2Json(JSONObject f) {
    if (this.getType() == null) {
        throw new IllegalStateException("field:" + this.getName() + " 's fieldType is can not be null");
    }
    // serialVisualType2Json(f, this.getType());
    SolrFieldsParser.SolrType solrType = this.getType();
    String type = solrType.getSType().getName();
    TokenizerType tokenizerType = TokenizerType.parse(type);
    if (tokenizerType == null) {
        // 非分词字段
        if (solrType.tokenizerable) {
            setStringType(f, type, ReflectSchemaFieldType.STRING.literia);
        } else {
            f.put("split", false);
            VisualType vtype = TokenizerType.visualTypeMap.get(type);
            if (vtype != null) {
                f.put(ISchemaField.KEY_FIELD_TYPE, vtype.getType());
                return;
            }
            f.put(ISchemaField.KEY_FIELD_TYPE, type);
        }
    } else {
        // 分词字段
        setStringType(f, tokenizerType.getKey(), ReflectSchemaFieldType.STRING.literia);
    }
// } else {
// throw new IllegalStateException("field:" + this.getName() + " 's fieldType is can not be null");
// }
}
Also used : SolrType(com.qlangtech.tis.solrdao.SolrFieldsParser.SolrType) VisualType(com.qlangtech.tis.runtime.module.misc.VisualType) SolrFieldsParser(com.qlangtech.tis.solrdao.SolrFieldsParser) TokenizerType(com.qlangtech.tis.runtime.module.misc.TokenizerType)

Aggregations

TokenizerType (com.qlangtech.tis.runtime.module.misc.TokenizerType)1 VisualType (com.qlangtech.tis.runtime.module.misc.VisualType)1 SolrFieldsParser (com.qlangtech.tis.solrdao.SolrFieldsParser)1 SolrType (com.qlangtech.tis.solrdao.SolrFieldsParser.SolrType)1