本文整理汇总了Python中store.Store.lucene_escape方法的典型用法代码示例。如果您正苦于以下问题:Python Store.lucene_escape方法的具体用法?Python Store.lucene_escape怎么用?Python Store.lucene_escape使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类store.Store
的用法示例。
在下文中一共展示了Store.lucene_escape方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: find
# 需要导入模块: from store import Store [as 别名]
# 或者: from store.Store import lucene_escape [as 别名]
def find(name, domain=None):
"Iterate through a series of MonitorAction nodes matching the criteria"
if MonitorAction.findquery is None:
cypher = "START m=node:MonitorAction({q}) RETURN m"
MonitorAction.findquery = neo4j.CypherQuery(CMAdb.store.db, cypher)
name = Store.lucene_escape(name)
qvalue = "%s:%s" % (name, "*" if domain is None else domain)
return CMAdb.store.load_cypher_nodes(MonitorAction.findquery, MonitorAction, params={"q": qvalue})
示例2: find
# 需要导入模块: from store import Store [as 别名]
# 或者: from store.Store import lucene_escape [as 别名]
def find(name, domain=None):
'Iterate through a series of MonitorAction nodes matching the criteria'
if MonitorAction.findquery is None:
MonitorAction.findquery = 'START m=node:MonitorAction({q}) RETURN m'
name = Store.lucene_escape(name)
qvalue = '%s:%s' % (name, '*' if domain is None else domain)
return CMAdb.store.load_cypher_nodes(MonitorAction.findquery, MonitorAction
, params={'q': qvalue})
示例3: find
# 需要导入模块: from store import Store [as 别名]
# 或者: from store.Store import lucene_escape [as 别名]
def find(designation, port=None, domain=None):
'Find a drone with the given designation or IP address, or Neo4J node.'
desigstr = str(designation)
if isinstance(designation, Drone):
designation.set_crypto_identity()
return designation
elif isinstance(designation, str):
if domain is None:
domain = CMAconsts.globaldomain
designation = designation.lower()
drone = CMAdb.store.load_or_create(Drone, port=port, domain=domain
, designation=designation)
assert drone.designation == designation
assert CMAdb.store.has_node(drone)
drone.set_crypto_identity()
return drone
elif isinstance(designation, pyNetAddr):
desig = designation.toIPv6()
desig.setport(0)
desigstr = str(desig)
if domain is None:
dstr = '*'
else:
dstr = domain
query = '%s:%s' % (str(Store.lucene_escape(desigstr)), dstr)
#We now do everything by IPv6 addresses...
drone = CMAdb.store.load_cypher_node(Drone.IPownerquery_1, Drone, {'ipaddr':query})
if drone is not None:
assert CMAdb.store.has_node(drone)
drone.set_crypto_identity()
return drone
if CMAdb.debug:
CMAdb.log.warn('Could not find IP NetAddr address in Drone.find... %s [%s] [%s]'
% (designation, desigstr, type(designation)))
if CMAdb.debug:
CMAdb.log.debug("DESIGNATION2 (%s) = %s" % (designation, desigstr))
CMAdb.log.debug("QUERY (%s) = %s" % (designation, query))
print >> sys.stderr, ("DESIGNATION2 (%s) = %s" % (designation, desigstr))
print >> sys.stderr, ("QUERY (%s) = %s" % (designation, query))
if CMAdb.debug:
raise RuntimeError('drone.find(%s) (%s) (%s) => returning None' % (
str(designation), desigstr, type(designation)))
#str(designation), desigstr, type(designation)))
#tblist = traceback.extract_stack()
##tblist = traceback.extract_tb(trace, 20)
#CMAdb.log.info('======== Begin missing IP Traceback ========')
#for tbelem in tblist:
#(filename, line, funcname, text) = tbelem
#filename = os.path.basename(filename)
#CMAdb.log.info('%s.%s:%s: %s'% (filename, line, funcname, text))
#CMAdb.log.info('======== End missing IP Traceback ========')
#CMAdb.log.warn('drone.find(%s) (%s) (%s) => returning None' % (
return None