forked from datavane/tis
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0566024
commit ad7c660
Showing
8 changed files
with
225 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,7 @@ | |
import com.qlangtech.tis.runtime.module.action.SchemaAction; | ||
import com.qlangtech.tis.runtime.module.action.SysInitializeAction; | ||
import com.qlangtech.tis.runtime.module.misc.IMessageHandler; | ||
import com.qlangtech.tis.runtime.module.screen.IndexQuery; | ||
import com.qlangtech.tis.runtime.module.screen.ViewPojo; | ||
import com.qlangtech.tis.solrdao.ISchemaField; | ||
import com.qlangtech.tis.solrdao.ISchemaPluginContext; | ||
|
@@ -86,8 +87,6 @@ | |
import java.util.concurrent.atomic.AtomicReference; | ||
import java.util.stream.Collectors; | ||
|
||
//import com.qlangtech.tis.coredefine.biz.CoreNode; | ||
|
||
/** | ||
* @author 百岁([email protected]) | ||
* @date 2020-12-13 16:10 | ||
|
@@ -115,6 +114,7 @@ public class CollectionAction extends com.qlangtech.tis.runtime.module.action.Ad | |
public static final String KEY_CORE_URL = "coreUrl"; | ||
public static final String KEY_IS_ACTIVE = "active"; | ||
public static final String KEY_REPLICS = "replics"; | ||
public static final String KEY_COLS_META = "colMetas"; | ||
|
||
|
||
// private | ||
|
@@ -177,6 +177,27 @@ public void doGetIndexTopology(Context context) throws Exception { | |
}).getSchemaParseResult(); | ||
|
||
biz.put(KEY_PK, parseResult.getUniqueKey()); | ||
|
||
|
||
QueryResutStrategy queryStrategy = QueryIndexServlet.createQueryResutStrategy( | ||
this.getAppDomain(), new IndexQuery.QueryRequestWrapper(getRequest(), context), getResponse(), getDaoContext()); | ||
List<ServerJoinGroup> nodes = queryStrategy.queryProcess(); | ||
List<PSchemaField> sfields = IndexQuery.getSfields(this.getRequest(), queryStrategy, nodes); | ||
JSONArray colsMeta = new JSONArray(); | ||
JSONObject colmeta = null; | ||
for (PSchemaField field : sfields) { | ||
colmeta = new JSONObject(); | ||
colmeta.put("name", field.getName()); | ||
colmeta.put("typeName", field.getType().getJavaType().getSimpleName()); | ||
colmeta.put("typeCode", field.getType().getJavaType().getTypeCode()); | ||
colmeta.put("docval", field.isDocValue()); | ||
colmeta.put("indexd", field.isIndexed()); | ||
colmeta.put("stored", field.isStored()); | ||
colmeta.put("dynamic", field.isDynamic()); | ||
colsMeta.add(colmeta); | ||
} | ||
biz.put(KEY_COLS_META, colsMeta); | ||
|
||
this.setBizResult(context, biz); | ||
} | ||
|
||
|
@@ -296,9 +317,6 @@ public void doCreate(Context context) throws Exception { | |
} | ||
this.setBizResult(context, new Object()); | ||
Objects.requireNonNull(dsTable, "dsTable can not be null"); | ||
// DataSourceFactoryPluginStore dsPluginStore = TIS.getDataBasePluginStore(new PostedDSProp(targetTable)); | ||
// // 保存表 | ||
// dsPluginStore.saveTable(targetTable, targetColMetas.targetColMetas); | ||
|
||
// 开始创建DF | ||
final String topologyName = indexName.param; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
tis-console/src/test/resources/com/qlangtech/tis/config/module/action/s4employee_schema.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE schema SYSTEM "solrres://tisrepository/dtd/solrschema.dtd"> | ||
<schema name="template" version="1.5"> | ||
<types> | ||
<fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true" omitTermFreqAndPositions="true" /> | ||
<fieldType name="int" class="solr.IntPointField" docValues="false" /> | ||
<fieldType name="float" class="solr.FloatPointField" docValues="false" /> | ||
<fieldType name="long" class="solr.LongPointField" docValues="false" /> | ||
<fieldType name="double" class="solr.DoublePointField" docValues="false" /> | ||
<fieldType name="date" class="com.qlangtech.tis.solrextend.fieldtype.TisDateField" docValues="false" /> | ||
<fieldType name="timestamp" class="com.qlangtech.tis.solrextend.fieldtype.TisTimestampField" docValues="false" /> | ||
<fieldType name="bitwise" class="com.qlangtech.tis.solrextend.fieldtype.BitwiseField" omitNorms="true" omitTermFreqAndPositions="true" /> | ||
<fieldType name="ik" class="solr.TextField" autoGeneratePhraseQueries="false" omitNorms="true" omitTermFreqAndPositions="false"> | ||
<analyzer type="query"> | ||
<tokenizer class="com.qlangtech.tis.solrextend.fieldtype.st.STConvertTokenizerFactory" /> | ||
<filter class="com.qlangtech.tis.solrextend.analyzer.IKTokenFilterFactory" /> | ||
<filter class="solr.LowerCaseFilterFactory" /> | ||
<filter class="solr.TrimFilterFactory" /> | ||
</analyzer> | ||
<analyzer type="index"> | ||
<tokenizer class="com.qlangtech.tis.solrextend.fieldtype.st.STConvertTokenizerFactory" /> | ||
<filter class="com.qlangtech.tis.solrextend.analyzer.IKTokenFilterFactory" /> | ||
</analyzer> | ||
</fieldType> | ||
<fieldType name="text_ws" class="solr.TextField" sortMissingLast="true" omitNorms="true" autoGeneratePhraseQueries="false" omitTermFreqAndPositions="true"> | ||
<analyzer> | ||
<tokenizer class="solr.WhitespaceTokenizerFactory" /> | ||
</analyzer> | ||
</fieldType> | ||
<fieldType name="like" class="solr.TextField" sortMissingLast="true" omitNorms="true" autoGeneratePhraseQueries="false" omitTermFreqAndPositions="true"> | ||
<analyzer type="index"> | ||
<tokenizer class="solr.NGramTokenizerFactory" minGramSize="2" maxGramSize="7" /> | ||
<filter class="solr.LowerCaseFilterFactory" /> | ||
</analyzer> | ||
<analyzer type="query"> | ||
<tokenizer class="solr.WhitespaceTokenizerFactory" /> | ||
<filter class="solr.LowerCaseFilterFactory" /> | ||
</analyzer> | ||
</fieldType> | ||
<fieldType name="pinyin" class="solr.TextField" positionIncrementGap="100" autoGeneratePhraseQueries="false" omitNorms="true" omitPositions="true"> | ||
<analyzer type="index"> | ||
<tokenizer class="solr.PatternTokenizerFactory" pattern=",\s*" /> | ||
<filter class="solr.NGramFilterFactory" minGramSize="1" maxGramSize="7" /> | ||
<filter class="solr.LowerCaseFilterFactory" /> | ||
<filter class="solr.TrimFilterFactory" /> | ||
<filter class="com.qlangtech.tis.solrextend.fieldtype.pinyin.PinyinTokenFilterFactory" /> | ||
</analyzer> | ||
<analyzer type="query"> | ||
<tokenizer class="solr.PatternTokenizerFactory" pattern=",\s*" /> | ||
<filter class="solr.LowerCaseFilterFactory" /> | ||
</analyzer> | ||
</fieldType> | ||
<fieldType name="test" class="plugin:test" positionIncrementGap="0" /> | ||
</types> | ||
<fields> | ||
<field name="emp_no" type="string" stored="true" indexed="true" docValues="true" multiValued="false" /> | ||
<field name="birth_date" type="date" stored="true" indexed="false" docValues="true" multiValued="false" /> | ||
<field name="first_name" type="test" stored="true" indexed="false" docValues="true" multiValued="false" /> | ||
<field name="last_name" type="string" stored="true" indexed="false" docValues="true" multiValued="false" /> | ||
<field name="gender" type="string" stored="true" indexed="false" docValues="true" multiValued="false" /> | ||
<field name="hire_date" type="timestamp" stored="true" indexed="false" docValues="true" multiValued="false" /> | ||
<field name="_version_" type="long" stored="true" indexed="false" docValues="true" multiValued="false" /> | ||
<field name="text" type="string" stored="false" indexed="true" docValues="false" multiValued="true" /> | ||
<dynamicField name="json_*" type="string" stored="true" indexed="true" docValues="true" multiValued="false" /> | ||
</fields> | ||
<uniqueKey>emp_no</uniqueKey> | ||
<sharedKey>emp_no</sharedKey> | ||
</schema> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
tis-solrconfig-parser/src/main/java/com/qlangtech/tis/solrdao/SolrJavaType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/** | ||
* Copyright (c) 2020 QingLang, Inc. <[email protected]> | ||
* <p> | ||
* This program is free software: you can use, redistribute, and/or modify | ||
* it under the terms of the GNU Affero General Public License, version 3 | ||
* or later ("AGPL"), as published by the Free Software Foundation. | ||
* <p> | ||
* This program is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. | ||
* <p> | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package com.qlangtech.tis.solrdao; | ||
|
||
import org.apache.commons.lang.StringUtils; | ||
|
||
import java.sql.Timestamp; | ||
import java.util.Date; | ||
|
||
/** | ||
* @author 百岁([email protected]) | ||
* @date 2021-02-25 17:00 | ||
*/ | ||
public enum SolrJavaType { | ||
INT(Integer.class, 1), FLOAT(Float.class, 2), DOUBLE(Double.class, 3), LONG(Long.class, 4), TIMESTAMP(Timestamp.class, 4), DATE(Date.class, 5), STRING(String.class, 6); | ||
|
||
public static SolrJavaType parse(String fieldType) { | ||
if (isTypeMatch(fieldType, "int")) { | ||
return INT; | ||
} else if (isTypeMatch(fieldType, "float")) { | ||
return FLOAT; | ||
} else if (isTypeMatch(fieldType, "double")) { | ||
return DOUBLE; | ||
} else if (isTypeMatch(fieldType, "long")) { | ||
return LONG; | ||
} else if (isTypeMatch(fieldType, "timestamp")) { | ||
return TIMESTAMP; | ||
} else if (isTypeMatch(fieldType, "date")) { | ||
return DATE; | ||
} | ||
return STRING; | ||
} | ||
|
||
private static boolean isTypeMatch(String fieldType, String matchLetter) { | ||
return StringUtils.indexOfAny(fieldType, new String[]{matchLetter, StringUtils.capitalize(matchLetter)}) > -1; | ||
} | ||
|
||
private final Class<?> javaType; | ||
private final int typeCode; | ||
// private final Method valueof; | ||
|
||
private SolrJavaType(Class<?> javaType, int typeCode) { | ||
this.javaType = javaType; | ||
this.typeCode = typeCode; | ||
// try { | ||
// if (javaType == String.class) { | ||
// valueof = javaType.getMethod("valueOf", Object.class); | ||
// } else { | ||
// valueof = javaType.getMethod("valueOf", String.class); | ||
// } | ||
// } catch (Exception e) { | ||
// throw new RuntimeException(e); | ||
// } | ||
} | ||
|
||
public int getTypeCode() { | ||
return typeCode; | ||
} | ||
|
||
public String getSimpleName() { | ||
return StringUtils.lowerCase(javaType.getSimpleName()); | ||
} | ||
} |
Oops, something went wrong.