public void searchTitle(int docId,RandomAccessFile raf,long start,long end,boolean wikiflag, boolean titleflag) {

    	//System.out.println(docId);
        
    	long mid;
        String res;
          try {
            while(start<=end) {
                mid=(start+end)/2;
                raf.seek(mid);
                raf.readLine();
                if((res=raf.readLine())!=null){
                    String[] tokens=res.split("#");
                    //System.out.println( tokens[0]);
                    
                    int comparison=Integer.parseInt(tokens[0]);
                    if(comparison==docId) {
                    	 if(!wikiflag && titleflag && tokens[1].contains("wiki"))
                    	 	break;
                    	 System.out.println( docId+" "+tokens[1]);
                         break;
                    }
                    else if(comparison<docId){
                        start=mid+1;
                    }
                    else {
                        end=mid-1;
                    }
                }
                else{
                    end=mid-1;
                }
            }
        }
        catch (Exception e) {
            e.printStackTrace();  
        }
    }