简体   繁体   中英

How to create search index with DSE search 6.8

I have been working with Datastax 6.7 for a couple of months now. Creating search index with the classic graph requires you create schema.xml and Solrconfig.xml through solr admin, which works fine. But when i upgraded to DSE 6.8, I need to create the search index using Datastax Studio 6.8. I have been able to create VertexLabels, materializedView and secondaryIndex. But i am unable to create a search index.

This is my code to create a search index,

  schema.vertexLabel('location').
  searchIndex().
  ifNotExists().
  by('geo_point').
  waitForIndex(3000).
  create()

This is the error i get,

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?

I have been able to create a graph core and search index successfully using these commands.

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;

you'll need to specify the schema and Solr configuration file like this on a Search node:

dsetool create_core ks_name.table_name schema=/path/to/schema.xml solrconfig=/path/to/solrconfig.xml

You can run these commands to check that they've been uploaded:

dsetool get_core_schema

dsetool get_core_config

You can run this command to check the status of the cores:

dsetool core_indexing_status -all

Insert data,

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);

Run your queries like this to test:

select * FROM geo.states

g.V().hasLabel('states_label')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM