在C#中创建搜索缓存 [英] creating searching cache in c#

查看:79
本文介绍了在C#中创建搜索缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Class1:



Class1:



public void getfol(string path)
        {

            SqlConnection conn = new SqlConnection("Data source=.;initial catalog=data_pc;integrated security=true");
           
            int i;
            try
            {
                string[] a = Directory.GetDirectories(path);
                for (i = 0; ; i++)
                {
                    SqlCommand cmd = new SqlCommand("insert into con values(@p)", conn);
                    cmd.Parameters.AddWithValue("@p", a[i]);
                    Console.WriteLine(a[i]);

                    bool isa = ((File.GetAttributes(a[i]) & FileAttributes.System) == FileAttributes.System);
                    if (isa == true)
                    {
                        SqlCommand md = new SqlCommand("insert into con values(@p)", conn);
                        md.Parameters.AddWithValue("@p", "next");
                        Console.WriteLine("bliisdsdsdszdsafsfdsF");

                        i++;

                    }

                    if (Directory.GetDirectories(a[i]).Length > 0)
                    {

                        getfol(a[i]);


                    }


                    if (Directory.GetFiles(a[i]).Length > 0)
                    {
                        getfil(a[i]);


                    }

                }

            }

            catch (Exception ec)
            {
                Console.WriteLine(ec.Message);
            }
        }
        public void getfil(String path)
        {
            SqlConnection conn = new SqlConnection("Data source=.;initial catalog=data_pc;integrated security=true");

            string[] p = Directory.GetFiles(path);
            for (int j = 0; j < p.Length; j++)
            {
                SqlCommand cmd = new SqlCommand("insert into con values(@p)", conn);
                cmd.Parameters.AddWithValue("@p", p[j]);
                conn.Open();
                cmd.ExecuteNonQuery();
                conn.Close();
                Console.WriteLine(p[j]);
            }
        }

    }






Program.cs






Program.cs

Class1 obj = new Class1();
            DriveInfo[] ab = DriveInfo.GetDrives();
            String str;
            for (int i = 0; i < ab.Length; i++)
            {
                str = ab[i].ToString();
                obj.getfol(str);
            }
            Console.ReadLine();





我编写了此程序来检索c#应用程序中硬盘的所有内容.现在,我希望它必须在后台检索所有内容,并且必须在表单上显示进度条.我希望我的应用程序应作为后台服务运行,即在按下窗体上的X后,一定不能关闭它,并且必须在Windows XP中的任务栏的左上角将其最小化.
另外,如果能告诉我如何使生成的缓存全文索引在sql server 2005中,将是很有意义的.我没有安装全文服务,请为我提供一个链接,用于下载单独的s​​ql server文件2005在其中安装自由文本.
问候,
真诚的,
Akky.





I wrote this program to retrieve all the contents of a hard disk in c# application. Now i want that it must be retrieve all contents on background and must show me a progress bar on a form. I want my application should run as background service i.e it must not be closed after pressing X on the form and must be minimized in the taskbar''s left corner as in windows xp.
Additionly,It would be appreciable if any could tell me that how can i make this generated cache fulltext indexed in sql server 2005. I don''t have the full text services installed so please provide me a link for downloading separate files for sql server 2005 to install freetext in it.
Regards,
Yours Sincerly,
Akky.

推荐答案

SQL Server不能以这种方式使用.

尝试使用 lucene.net [ ^ ]或我的文章 hOOt-全文搜索引擎 [ ^ ].
SQL Server is not meant to be used in this way.

Try using lucene.net[^] or my article hOOt - full text search engine[^].


这篇关于在C#中创建搜索缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆