public static ArrayList<InveList> nearOperate (ArrayList<InveList>result , ArrayList<InveList>ret){
		int n = Integer.parseInt(currentNode.getName().substring(6, 7));
		int i = 0;
		int j = 0;
		//two pointers for two inverted list of two documents
		//and the near range is stored in variable n
		ArrayList<InveList> tempResult = new ArrayList<InveList>();

		while ((i < result.size()) && (j < ret.size())) {
			int ID1 = result.get(i).getDocID();
			int ID2 = ret.get(j).getDocID();

			if (ID1 == ID2) {
				//if two pointers point to same document
				//get two position lists
				ArrayList<Integer> posList1 = result.get(i).getPos();
				ArrayList<Integer> posList2 = ret.get(j).getPos();
				ArrayList<Integer> samePosList = new ArrayList<Integer>();
				int posPointer1 = 0;
				int posPointer2 = 0;
				//have two new pointer for position lists
				int sameCount = 0;

				while ((posPointer1 < posList1.size()) && (posPointer2 < posList2.size())) {
					if (posList2.get(posPointer2) - posList1.get(posPointer1) > n) {
						posPointer1++;
					}
					else if (posList2.get(posPointer2) - posList1.get(posPointer1) < 0) {
						posPointer2++;
					}
					else if (posList2.get(posPointer2) - posList1.get(posPointer1) <= n){
						//only document with word1 prior to words within n-1 words can be treat as a match
						sameCount++;
						samePosList.add(posList2.get(posPointer2));
						posPointer1++;
						posPointer2++;
					}
				}
				if (sameCount != 0){
					//if this document has position matches
					//add it into the result
					//score will be match time
					InveList tmp = new InveList(result.get(i).getDocID());
					tmp.setTf(sameCount);
					tmp.setPos(samePosList);
					tempResult.add(tmp);
				}
				i++;
				j++;
			}
			else if (ID1 > ID2)
				//if two pointers point to different document
				//move the smaller pointer
				j++;
			else if (ID1 < ID2)
				//if two pointers point to different document
				//move the smaller pointer
				i++;
		}


		return tempResult;
	}