Search in sources :

Example 1 with LindenSchema

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

the class TestLindenCore 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).setMulti(true).setStored(true).setMulti(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 2 with LindenSchema

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

the class TestLindenFacet method init.

@Override
public void init() throws Exception {
    LindenSchema schema = new LindenSchema().setId("id");
    schema.addToFields(new LindenFieldSchema().setName("Language").setTokenized(false).setIndexed(true));
    schema.addToFields(new LindenFieldSchema().setName("Title").setTokenized(true).setIndexed(true));
    schema.addToFields(new LindenFieldSchema().setName("Author").setType(LindenType.FACET).setStored(true).setIndexed(true));
    schema.addToFields(new LindenFieldSchema().setName("PublishDate").setType(LindenType.FACET).setStored(true));
    lindenConfig.setSchema(schema);
    lindenConfig.putToProperties("cluster.url", "localhost:2183/facettest");
    lindenConfig.putToProperties("port", "19090");
    lindenConfig.putToProperties("shard.id", "0");
    lindenConfig.putToProperties("index.directory", "/tmp/linden-facet-test/index/0");
    lindenConfig.putToProperties("log.path", "/tmp/linden-facet-test/log/0");
    lindenConfig.putToProperties("search.timeout", "0");
}
Also used : LindenFieldSchema(com.xiaomi.linden.thrift.common.LindenFieldSchema) LindenSchema(com.xiaomi.linden.thrift.common.LindenSchema)

Example 3 with LindenSchema

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

the class TestLindenFieldCache method init.

@Override
public void init() throws Exception {
    LindenSchema schema = new LindenSchema().setId("id");
    schema.addToFields(new LindenFieldSchema().setName("title").setIndexed(true).setTokenized(true));
    schema.addToFields(new LindenFieldSchema().setName("ids_int").setType(LindenType.INTEGER).setIndexed(true).setTokenized(true).setMulti(true));
    schema.addToFields(new LindenFieldSchema().setName("ids_long").setType(LindenType.INTEGER).setIndexed(true).setTokenized(true).setMulti(true));
    schema.addToFields(new LindenFieldSchema().setName("ids_str").setType(LindenType.STRING).setIndexed(true).setTokenized(true).setMulti(true));
    schema.addToFields(new LindenFieldSchema().setName("ids_float").setType(LindenType.FLOAT).setIndexed(true).setTokenized(false).setMulti(true));
    schema.addToFields(new LindenFieldSchema().setName("ids_double").setType(LindenType.DOUBLE).setIndexed(true).setTokenized(false).setMulti(true));
    schema.addToFields(new LindenFieldSchema().setName("rank").setType(LindenType.FLOAT).setIndexed(true));
    lindenConfig.setSchema(schema);
}
Also used : LindenFieldSchema(com.xiaomi.linden.thrift.common.LindenFieldSchema) LindenSchema(com.xiaomi.linden.thrift.common.LindenSchema)

Example 4 with LindenSchema

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

the class TestLindenJiebaAnalyzerSearchMode 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", "search");
}
Also used : LindenFieldSchema(com.xiaomi.linden.thrift.common.LindenFieldSchema) LindenSchema(com.xiaomi.linden.thrift.common.LindenSchema)

Example 5 with LindenSchema

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

the class TestLindenMMSeg4jAnalyzer 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.LindenMMSeg4jAnalyzerFactory");
    lindenConfig.putToProperties("index.analyzer.class", "com.xiaomi.linden.lucene.analyzer.LindenMMSeg4jAnalyzerFactory");
}
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