private void buildFailPath() {
		Deque<TrieNode> nodes = new LinkedList<TrieNode>();
		// 第二层要特殊处理，将这层中的节点的失败路径直接指向父节点(也就是根节点)。
		for (char ch : this.root.keys()) {
			TrieNode child = this.root.get(ch);
			child.setFail(this.root);
			nodes.add(child);
		}

		while (!nodes.isEmpty()) {
			TrieNode node = nodes.pop();
			char[] keys = node.keys();
			for (int i = 0; i < keys.length; i++) {
				TrieNode r = node;

				char ch = keys[i];
				TrieNode child = r.get(ch);
				nodes.add(child);

				r = r.getFail();
				while (null != r && r.get(ch) == null) {
					r = r.getFail();
				}
				if(null == r) {
					child.setFail(this.root);
				} else {
					child.setFail(r.get(ch));
					r.getResults().addAll(r.get(ch).getResults());
				}
				
			}
		}
	}