Search in sources :

Example 11 with LindenSchema

use of com.xiaomi.linden.thrift.common.LindenSchema in project linden by XiaoMi.

the class TestLindenMetricPlugin method init.

@Override
public void init() throws Exception {
    LindenSchema schema = new LindenSchema().setId("id");
    schema.addToFields(new LindenFieldSchema().setName("title").setIndexed(true).setStored(true).setTokenized(true));
    schema.addToFields(new LindenFieldSchema().setName("field1").setIndexed(true).setStored(false));
    schema.addToFields(new LindenFieldSchema().setName("field2").setIndexed(true).setTokenized(true).setStored(false).setOmitFreqs(true).setOmitNorms(true));
    schema.addToFields(new LindenFieldSchema().setName("rank").setType(LindenType.FLOAT).setIndexed(true).setStored(true));
    schema.addToFields(new LindenFieldSchema().setName("cat1").setType(LindenType.INTEGER).setIndexed(true).setStored(true));
    schema.addToFields(new LindenFieldSchema().setName("cat2").setType(LindenType.DOUBLE).setIndexed(true).setStored(true));
    schema.addToFields(new LindenFieldSchema().setName("tagstr").setIndexed(true));
    schema.addToFields(new LindenFieldSchema().setName("hotwords").setStored(true));
    schema.addToFields(new LindenFieldSchema().setName("tagnum").setType(LindenType.INTEGER).setIndexed(true));
    lindenConfig.setSchema(schema);
}
Also used : LindenFieldSchema(com.xiaomi.linden.thrift.common.LindenFieldSchema) LindenSchema(com.xiaomi.linden.thrift.common.LindenSchema)

Example 12 with LindenSchema

use of com.xiaomi.linden.thrift.common.LindenSchema in project linden by XiaoMi.

the class TestLindenJiebaAnalyzerIndexMode method init.

@Override
public void init() {
    lindenConfig.setIndexType(LindenConfig.IndexType.RAM);
    lindenConfig.setClusterUrl("127.0.0.1:2181/mock");
    LindenSchema schema = new LindenSchema().setId("id");
    schema.addToFields(new LindenFieldSchema().setName("title").setIndexed(true).setTokenized(true).setSnippet(true).setMulti(true));
    lindenConfig.setSchema(schema);
    lindenConfig.putToProperties("search.analyzer.class", "com.xiaomi.linden.lucene.analyzer.LindenJiebaAnalyzerFactory");
    lindenConfig.putToProperties("index.analyzer.class", "com.xiaomi.linden.lucene.analyzer.LindenJiebaAnalyzerFactory");
    lindenConfig.putToProperties("index.analyzer.mode", "index");
}
Also used : LindenFieldSchema(com.xiaomi.linden.thrift.common.LindenFieldSchema) LindenSchema(com.xiaomi.linden.thrift.common.LindenSchema)

Example 13 with LindenSchema

use of com.xiaomi.linden.thrift.common.LindenSchema in project linden by XiaoMi.

the class TestHotSwapLindenCore method init.

public void init() throws Exception {
    LindenSchema schema = new LindenSchema().setId("id");
    schema.addToFields(new LindenFieldSchema().setName("title").setIndexed(true).setStored(true).setTokenized(true));
    lindenConfig = new LindenConfig();
    lindenConfig.setClusterUrl("127.0.0.1:2181/test");
    lindenConfig.setSchema(schema);
    String path = FilenameUtils.concat(TestMultiLindenCore.class.getResource("./").getPath(), "index/");
    FileUtils.deleteQuietly(new File(path));
    lindenConfig.setIndexDirectory(path);
    lindenConfig.setLindenCoreMode(LindenConfig.LindenCoreMode.HOTSWAP);
}
Also used : LindenFieldSchema(com.xiaomi.linden.thrift.common.LindenFieldSchema) LindenSchema(com.xiaomi.linden.thrift.common.LindenSchema) File(java.io.File)

Example 14 with LindenSchema

use of com.xiaomi.linden.thrift.common.LindenSchema in project linden by XiaoMi.

the class TestLindenAggregation method init.

@Override
public void init() throws Exception {
    LindenSchema schema = new LindenSchema().setId("id");
    schema.addToFields(new LindenFieldSchema().setName("intValue").setType(LindenType.INTEGER).setDocValues(true));
    lindenConfig.setSchema(schema);
}
Also used : LindenFieldSchema(com.xiaomi.linden.thrift.common.LindenFieldSchema) LindenSchema(com.xiaomi.linden.thrift.common.LindenSchema)

Example 15 with LindenSchema

use of com.xiaomi.linden.thrift.common.LindenSchema in project linden by XiaoMi.

the class TestLindenDynamicField method init.

@Override
public void init() {
    schema = new LindenSchema().setId("id");
    schema.addToFields(new LindenFieldSchema("name", LindenType.STRING).setIndexed(true).setTokenized(true).setStored(true));
    schema.addToFields(new LindenFieldSchema("level", LindenType.STRING).setIndexed(true).setStored(true));
    schema.addToFields(new LindenFieldSchema("log", LindenType.STRING).setIndexed(true).setTokenized(true).setStored(true));
    schema.addToFields(new LindenFieldSchema("host", LindenType.STRING).setIndexed(true).setStored(true));
    schema.addToFields(new LindenFieldSchema("shard", LindenType.INTEGER).setIndexed(true).setStored(true));
    lindenConfig.setSchema(schema);
}
Also used : LindenFieldSchema(com.xiaomi.linden.thrift.common.LindenFieldSchema) LindenSchema(com.xiaomi.linden.thrift.common.LindenSchema)

Aggregations

LindenSchema (com.xiaomi.linden.thrift.common.LindenSchema)21 LindenFieldSchema (com.xiaomi.linden.thrift.common.LindenFieldSchema)17 File (java.io.File)5 Test (org.junit.Test)3 LindenConfig (com.xiaomi.linden.core.LindenConfig)1 LindenIndexRequest (com.xiaomi.linden.thrift.common.LindenIndexRequest)1 IOException (java.io.IOException)1 DocumentBuilder (javax.xml.parsers.DocumentBuilder)1 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)1 Document (org.w3c.dom.Document)1 Element (org.w3c.dom.Element)1 Node (org.w3c.dom.Node)1 NodeList (org.w3c.dom.NodeList)1