示例#1
0
    def add_document(self, docID, wordList):
        self.socket.send(config.COMMAND_ADD_DOC)
        self.socket.send(config.pack_docID(docID))
        self.socket.send(struct.pack('I', len(wordList)))
        self.socket.send(struct.pack('I', sum(word.weight for word in wordList)))

        for word in wordList:
            self.socket.send(config.pack_word(word) + struct.pack('B', word.weight))
示例#2
0
文件: nodes.py 项目: c24b/indexd
 def send(self, socket):
     socket.send(config.QNODE_KW)
     socket.send(config.pack_word(self.word))
示例#3
0
 def send(self, socket):
     socket.send(config.QNODE_KW)
     socket.send(config.pack_word(self.word))