Skip to content

Instantly share code, notes, and snippets.

@graben1437
Last active August 29, 2015 14:11
Show Gist options
  • Save graben1437/6d8d272913bcd4bc8220 to your computer and use it in GitHub Desktop.
Save graben1437/6d8d272913bcd4bc8220 to your computer and use it in GitHub Desktop.
conf = new BaseConfiguration()
conf.setProperty('storage.index.search.backend', 'com.thinkaurelius.titan.diskstorage.solr')
conf.setProperty('storage.backend', 'cassandra')
conf.setProperty('storage.hostname', 'X.XX.XXX.XXX')
conf.setProperty('cache.db-cache', 'true')
conf.setProperty('cache.db-cache-clean-wait', '20')
conf.setProperty('cache.db-cache-time', '180000')
conf.setProperty('cache.db-cache-size', '0.25')
conf.setProperty('index.search.backend', 'solr')
conf.setProperty('index.search.solr.mode', 'http')
conf.setProperty('index.search.solr.http-urls', 'http://X.XX.XXX.XXX:8983/solr/collection1')
g=TitanFactory.open(conf)
mgmt = g.getManagementSystem()
two = mgmt.makePropertyKey('two').dataType(String.class).make()
mgmt.buildIndex('twoidx', Vertex.class).addKey(two, Mapping.TEXT.getParameter()).buildMixedIndex("search")
mgmt.commit()
v2 = g.addVertex()
v2.setProperty('two', 'Wanda Maximoff Marvel Comics')
g.commit()
g.query().has('two', CONTAINS, 'Maximoff Marvel').vertices()
// sample output from the query follows
// 13:57:01 ERROR com.thinkaurelius.titan.diskstorage.solr.SolrIndex - Query did not complete because parameters were not recognized :
// org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException: org.apache.solr.search.SyntaxError: Cannot parse '++4flx_t:(maximoff) +4flx_t:(marvel) ': Encountered " "+" "+ "" at line 1, column 1.
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment