public ReturnValue stringSearch (QueryConfig config) throws Throwable {
		
		ReturnValue revalue = new ReturnValue();
		//store the query
		revalue.querystring = config.getQuerystring();
		//the enumerator of value list
		DocsEnum value_enum;
		//create a term for query
		Term qterm = new Term(fieldname2,config.getQuerystring());
		//store the query id and query string
		String id_query = String.valueOf(config.queryId)+"+"+config.getQuerystring();
		//if we do not have to scan from the beginning
		if(config.needRestart == false) {
			if(position_map.containsKey(id_query)) {
				System.out.println(id_query + " is found in map");
				//get the enumerator directly from the hash map
				value_enum = position_map.get(id_query);
			}
			else
			{
				System.out.println("preposition: "+config.pre_position);
				value_enum = areader.termDocsEnum(qterm);
				//scan to the previous position
				value_enum.advance(config.pre_position);
			}
		}
		//else create new enumerator and scan from beginning
		else {
			//find the exact entrance of the value list
			value_enum = areader.termDocsEnum(qterm);
		}
		//scan the list for a certain length
		int count = 0, lucene_doc_id = -1;
		String element_id = null;
		while (count < config.getLength()) {
			//not found
			if(value_enum == null) {
				System.out.println("the feature is not found");
				return null;
			}
			//scan the list
			lucene_doc_id = value_enum.nextDoc();
			//at the end of the list
			if(lucene_doc_id == DocsEnum.NO_MORE_DOCS) {
				revalue.current_values.add("-1");
				//store current position
				revalue.pre_position = lucene_doc_id;
				position_map.put(id_query, value_enum);
				return revalue;
			}
			count++;
			
			//update the table
			//get the element id
			element_id = indexReader.document(lucene_doc_id).getField(fieldname1).stringValue();
			//update count
			Double count_distance[] = new Double[2];
			if(revalue.table.containsKey(element_id)) {
				count_distance = revalue.table.get(element_id);
				//count++
				count_distance[0] += 1.0;
				revalue.table.put(element_id, count_distance);
			}
			else {
				//count = 1
				count_distance[0] = 1.0;
				//accumulate distance = 0
				count_distance[1] = 0.0;
				revalue.table.put(element_id, count_distance);
			}
		}
		revalue.current_values.add(element_id);
		//store the current enumerator
		revalue.pre_position = lucene_doc_id;
		//update the position map
		position_map.put(id_query, value_enum);
		return revalue;
	}