View Poll Results: Is this Search any good????

Voters
2. You may not vote on this poll
  • Yes

    1 50.00%
  • No

    1 50.00%
Results 1 to 13 of 13
Like Tree1Likes
  • 1 Post By DarrylBurke

Thread: How Effecient is this Desktop Search Engine????? need suggestions!!!!

  1. #1
    drakula941 is offline Member
    Join Date
    Nov 2011
    Posts
    23
    Rep Power
    0

    Smile How Effecient is this Desktop Search Engine????? need suggestions!!!!

    This code scans the entire system and creates an Index file...
    ================================================== ================================================== ===
    import java.io.*;
    public class Scan_Engine
    {
    static int File_Count=0;
    FileOutputStream File_Out_Stream=new FileOutputStream("C:/my3.txt");
    PrintStream Print_Stream=new PrintStream(File_Out_Stream);
    public void Scan(File Scan_File)throws Exception
    {
    if(Scan_File.isFile())
    {
    Print_Stream.println(Scan_File);
    File_Count++;
    }else
    {
    File[] File_List = Scan_File.listFiles();
    if(File_List!=null)
    {
    for (int i = 0; i <File_List.length ; i++)
    {
    Scan(File_List[i]);
    }
    }
    }
    }

    public Scan_Engine()throws Exception
    {
    File[] roots = File.listRoots();
    for (int x=0;x<roots.length;x++)
    {
    File Scan_File = roots[x];
    Scan(Scan_File);
    }
    File_Out_Stream=new FileOutputStream("C:/flcount.txt");
    Print_Stream=new PrintStream(File_Out_Stream);
    Print_Stream.println(File_Count);
    }

    public static void main(String[] args)throws Exception
    {
    System.out.println("Scanning Files");
    long startTime = System.currentTimeMillis();
    new Scan_Engine();
    long endTime = System.currentTimeMillis();
    System.out.println("Total elapsed time in execution of method callMethod() is :"+ (endTime-startTime));
    System.out.println(File_Count);
    }
    }
    ================================================== ================================================== ===
    This code does the searching work.... the search yet is case sensative...will fix that soon!!!!
    ================================================== ================================================== ===
    import java.io.*;
    class search
    {
    public static void main(String arg[])throws Exception
    {
    String change="";
    String temp="";
    int Memory=0;
    int Word_Count=1;
    int Result=0;
    int file_count=0;
    int Counter=0;
    int Word_Index=0;
    FileInputStream in=new FileInputStream("C:/flcount.txt");
    BufferedReader Buffer=new BufferedReader(new InputStreamReader(in));
    if((temp=Buffer.readLine())!=null)
    {
    Memory=Integer.parseInt(temp);
    }
    in = new FileInputStream("C:/my3.txt");
    Buffer=new BufferedReader(new InputStreamReader(in));
    String File_list[][]=new String[2][Memory];
    for(int i=0;i<Memory;i++)
    {
    temp=Buffer.readLine();
    File_list[0][i]=temp;
    File_list[1][i]=temp.substring((temp.lastIndexOf('\\')+1),temp.le ngth());
    }
    BufferedReader user=new BufferedReader(new InputStreamReader(System.in));
    System.out.println("Enter the file you want to search");
    String search=user.readLine();
    int len=search.length();
    for(int j=0;j<len;j++)
    {
    if(search.charAt(j)==' ')
    {
    Word_Count++;
    }
    }
    String Compare_To[]=new String[Word_Count];
    for(int i=0;i<Word_Count;i++)
    {
    for(int j=Word_Index;j<len;j++)
    {
    char ch=search.charAt(j);
    if(ch==' ')
    {
    Word_Index++;
    break;
    }
    else
    {
    Word_Index++;
    change+=ch;
    }
    }
    Compare_To[i]=change;
    change="";
    }
    for(int x=0;x<Memory;x++)
    {
    if(File_list[1][x].length()>=len)
    {
    for(int j=0;j<Word_Count;j++)
    {
    if(File_list[1][x].contains(Compare_To[j]))
    {
    Counter++;
    if(Counter==Word_Count)
    {
    System.out.println(File_list[0][x]);
    Result++;
    file_count++;
    }
    }
    }
    Counter=0;
    }
    }
    if(Result==0)
    {
    System.out.println("NOT FOUND");
    }
    else
    System.out.println("Files Found "+file_count);
    }
    }
    ================================================== ================================================== ===
    Please give some suggestions.... on a comparison with the windows desktop search!!!!!

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,184
    Rep Power
    19

    Default Re: How Effecient is this Desktop Search Engine????? need suggestions!!!!

    Please give some suggestions
    1. Go through the forum FAQs and learn to use the code tags.
    2. Follow Java coding conventions in respect of class and variable names.

    db
    Last edited by DarrylBurke; 02-14-2012 at 01:12 PM.
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    drakula941 is offline Member
    Join Date
    Nov 2011
    Posts
    23
    Rep Power
    0

    Default Re: How Effecient is this Desktop Search Engine????? need suggestions!!!!

    Quote Originally Posted by DarrylBurke View Post
    1. Go through the forum FAQs and learn to use the code tags.
    2. Follow Java coding conventions in respect of class and variable names.

    db
    ohk!!! will do that ... but for now can you just execute the code and check its efficiency?????

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,184
    Rep Power
    19

    Default Re: How Effecient is this Desktop Search Engine????? need suggestions!!!!

    Nope. Testing doesn't interest me.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  5. #5
    drakula941 is offline Member
    Join Date
    Nov 2011
    Posts
    23
    Rep Power
    0

    Default Re: How Effecient is this Desktop Search Engine????? need suggestions!!!!

    Quote Originally Posted by DarrylBurke View Post
    Nope. Testing doesn't interest me.

    db
    OHK!!!! Then WHAT does INTEREST you SIR????? only the code??

  6. #6
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,184
    Rep Power
    19

    Default Re: How Effecient is this Desktop Search Engine????? need suggestions!!!!

    Quote Originally Posted by drakula941 View Post
    OHK!!!! Then WHAT does INTEREST you SIR????? only the code??
    Helping you to improve yourself.

    db
    drakula941 likes this.
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  7. #7
    drakula941 is offline Member
    Join Date
    Nov 2011
    Posts
    23
    Rep Power
    0

    Default Re: How Effecient is this Desktop Search Engine????? need suggestions!!!!

    Quote Originally Posted by DarrylBurke View Post
    Helping you to improve yourself.

    db
    Thank you!!!!! :-) but do you think just spending two minutes to test the code would be somthing too much for you??? Its a request..... please test the code comparing it to windows desktop search and give me a review over it!!!!

  8. #8
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    11,853
    Rep Power
    19

    Default Re: How Effecient is this Desktop Search Engine????? need suggestions!!!!

    It is seriously unlikely to be as efficient as the Windows search as the OS interacts directly with the file system and can use tricks against that, whereas your code is sitting on top of a JVM that sits on top of the OS that sits on top of the file system...

  9. #9
    drakula941 is offline Member
    Join Date
    Nov 2011
    Posts
    23
    Rep Power
    0

    Default Re: How Effecient is this Desktop Search Engine????? need suggestions!!!!

    Quote Originally Posted by Tolls View Post
    It is seriously unlikely to be as efficient as the Windows search as the OS interacts directly with the file system and can use tricks against that, whereas your code is sitting on top of a JVM that sits on top of the OS that sits on top of the file system...
    Tolls - Thanks for your opinion!!!! :-)
    thats very true i know that.... i hav given that indexing engine just to test the code.... but just test any file in windows search which takes around 4-5 sec nd take the same name and use it in my code.....i am pretty sure this search Engine would work faster.... you can compare any file.... just dont fuget 1 thing...... this is still case sesative!!!!! :-)

  10. #10
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    11,853
    Rep Power
    19

    Default Re: How Effecient is this Desktop Search Engine????? need suggestions!!!!

    We're not going to do your performance testing for you...well, unless you pay us I suppose.
    And most of us aren't all that cheap.

  11. #11
    drakula941 is offline Member
    Join Date
    Nov 2011
    Posts
    23
    Rep Power
    0

    Default Re: How Effecient is this Desktop Search Engine????? need suggestions!!!!

    Quote Originally Posted by Tolls View Post
    We're not going to do your performance testing for you...well, unless you pay us I suppose.
    And most of us aren't all that cheap.
    I feel i am at the wrong place with my stuff..... i hav already tested it...... was just asking for others suggestion on how they feel after using it!!!!!! i dont think spending couple of your minutes in testing the code and giving the poll by yes or no will take more time than posting useless comments.... and for performance testing i know many people who would do it free of cost for me..... just wanted those people's suggestion who like to help others!!!

  12. #12
    drakula941 is offline Member
    Join Date
    Nov 2011
    Posts
    23
    Rep Power
    0

    Default Re: How Effecient is this Desktop Search Engine????? need suggestions!!!!


  13. #13
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,184
    Rep Power
    19

    Default Re: How Effecient is this Desktop Search Engine????? need suggestions!!!!

    drakula941, the new thread you started in New to Java with the same link has been reported to the authorities as spam and removed.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Any suggestions for My search method?
    By kevkid in forum New To Java
    Replies: 5
    Last Post: 05-10-2011, 09:08 PM
  2. I want to build a Search Engine
    By shahid0627 in forum Forum Lobby
    Replies: 1
    Last Post: 05-17-2010, 11:26 PM
  3. Search Engine on JSP Page
    By samanthamaryhorgan in forum Advanced Java
    Replies: 0
    Last Post: 02-13-2010, 12:40 PM
  4. Desktop Application - Suggestions
    By jedai in forum AWT / Swing
    Replies: 0
    Last Post: 04-26-2009, 04:43 AM
  5. Search Engine
    By SSam Varghese in forum Java Servlet
    Replies: 5
    Last Post: 01-05-2008, 08:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •