public void addDoc(int did) {

		// Check if we need to add a skip list node
		if (numDocs == 0) {
			SkipNode node = new SkipNode(did, docs.size(), weights.size());
			skipList.add(node);
		} else if (numDocs % SKIP_INTERVAL == 0) {
			SkipNode node = new SkipNode(lastDid, docs.size(), weights.size());
			skipList.add(node);
		}

		int delta = 0;
		if (numDocs != 0) {
			delta = did - lastDid;
		}

		lastDid = did;

		// Delta must always be positive!
		if (delta < 0) {
			throw new RuntimeException("Unsorted docs!");
		}

		while (true) {
			// Extract the lower 7 bits
			byte data = (byte) (delta & 0x7f);
			// Shift the delta by 7 bits
			delta = delta >> 7;
			if (delta != 0) {
				// Set the 8th bit
				data |= (byte) (data | 0x80);
			}
			docs.add(data);
			if (delta == 0) {
				break;
			}
		}

		numDocs++;
	}