Skip to content

Instantly share code, notes, and snippets.

@graben1437
Last active August 29, 2015 14:11
Show Gist options
  • Save graben1437/a8e794f3117270bb08ab to your computer and use it in GitHub Desktop.
Save graben1437/a8e794f3117270bb08ab 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()
one = mgmt.makePropertyKey('one').dataType(String.class).make()
mgmt.buildIndex('oneidx', Vertex.class).addKey(one, Mapping.STRING.getParameter()).buildMixedIndex("search")
mgmt.commit()
v1 = g.addVertex()
v1.setProperty('one', 'Maria Hill Marvel Comics')
g.commit()
g.query().has('one', CONTAINS, 'Hill Marvel').vertices()
// sample output from the query statement follows
// 13:55:45 WARN com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx - Query requires iterating over all vertices [(one CONTAINS Hill Marvel)]. For better performance, use indexes
// 13:55:46 WARN com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx - Query requires iterating over all vertices [(one CONTAINS Hill Marvel)]. For better performance, use indexes
// ==>v[256]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment