Пример #1
0
    def graf2solr(self):   
	topnodes = self.ut_tree.edged.keys() 
	#print topnodes
	for topnode in topnodes:
	    #print topnode
	    try:
		ID = self.getID(topnode)	    
	    except KeyError: 
		print "no ID\n\t%s" % self.getText(topnode)
		#ID = "rnd"+str(random.randint(1000000,9999999))
		continue	
	    if ID == '':
		print "no ID\n\t%s" % self.getText(topnode)
		#ID = "rnd"+str(random.randint(1000000,9999999))
		continue	
		
	    athasolr = AthaSOLR(ID, topnode, self) 
	    athasolr.formattemplate()
	    athasolr.write() 
Пример #2
0
    def graf2json(self): 
	topnodes = self.ut_tree.edged.keys() 
	#print topnodes
	results = []
	ids = []
	for topnode in topnodes:
	    #print topnode
	    try:
		ID = self.getID(topnode)	    
	    except KeyError: 
		#print "no ID\n\t%s" % self.getText(topnode)
		ID = "rnd"+str(random.randint(1000000,9999999))
		#continue	
	    if ID == '':
		#print "no ID\n\t%s" % self.getText(topnode)
		ID = "rnd"+str(random.randint(1000000,9999999))
		#continue			
	    athasolr = AthaSOLR(ID, topnode, self) 
	    results.append(athasolr.forjson())
	    ids.append(ID)
	    #out = open('debug.json', 'w')    
	    #out.write(result)
	    #out.close()
	return results, ids