我已经使用Datastax 6.7了几个月。使用经典图形创建搜索索引需要您通过solr admin创建schema.xml和Solrconfig.xml,这很好用。但是,当我升级到DSE 6.8时,我需要使用Datastax Studio 6.8创建搜索索引。我已经能够创建VertexLabels,materializedView和secondaryIndex。但是我无法创建搜索索引。
这是我创建搜索索引的代码,
schema.vertexLabel('location').
searchIndex().
ifNotExists().
by('geo_point').
waitForIndex(3000).
create()
这是我得到的错误,
java.lang.IllegalStateException: Could not create search index for vertex label 'location' in graph 'food_cql'. RELOAD or REBUILD failed for search index on 'food_cql.location'. Failed to reload search index food_cql.location because: No resource solrconfig.xml for core food_cql.location, did you miss to upload it?
我已经能够使用这些命令成功创建图形核心并搜索索引。
CREATE KEYSPACE IF NOT EXISTS geo WITH replication = {'class': 'SimpleStrategy', 'replication_factor' : 2};
CREATE TABLE IF NOT EXISTS geo.states (
state text,
fips int,
pop int,
geo text,
solr_query text,
PRIMARY KEY (state)
)WITH VERTEX LABEL states_label;
您需要在搜索节点上像这样指定架构和Solr配置文件:
dsetool create_core ks_name.table_name schema=/path/to/schema.xml solrconfig=/path/to/solrconfig.xml
您可以运行以下命令来检查它们是否已上传:
dsetool get_core_schema
dsetool get_core_config
您可以运行此命令来检查核心的状态:
dsetool core_indexing_status -all
插入数据,
INSERT INTO geo.states (state, fips, geo, pop) VALUES ('Idahonew',60, 'POLYGON ((-116.04751 49.000239, -116.04751 47.976051, -115.724371 47.696727))', 3594);
像这样运行查询以进行测试:
select * FROM geo.states
g.V().hasLabel('states_label')