Exemplo n.º 1
0
        //constructor
        public IndexForm()
        {
            InitializeComponent();
            indexSetting    = new IndexSetting();
            luceneIndex_app = new LuceneSearch();
            articles        = new List <JournalArticle>();

            //default path for index object and articles
            docPathLabel.Text   = @"D:\IFN647_prj\crandocs";
            indexPathLabel.Text = @"D:\IFN647_prj\index";
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            LuceneSearch myLuceneApp = new LuceneSearch();

            // TODO: ADD PATHNAME
            string indexPath = @"C:\w5_index\";

            myLuceneApp.CreateIndex(indexPath);

            System.Console.WriteLine("Adding Documents to Index");

            List <string> l = new List <string>();

            l.Add("IPhone 7 dasd");
            l.Add("Samsung 6 sadd");
            l.Add("Windows 10 sadsa d");
            l.Add("Iphone 6 sadsa d");
            l.Add("Iphone 5s sadsa d");
            l.Add("Samsung Galaxy Note 6 sadsa d");

            ///
            l.Add("*****@*****.**");
            l.Add("*****@*****.**");
            l.Add("*****@*****.**");
            l.Add("*****@*****.**");

            foreach (string s in l)
            {
                System.Console.WriteLine("Adding " + s + "  to Index");
                myLuceneApp.IndexText(s);
            }

            System.Console.WriteLine("All documents added.");
            //create searcher & parser
            myLuceneApp.CreateSearcher();
            myLuceneApp.CreateParser();
            //query
            TopDocs topDocs = myLuceneApp.SearchIndex("*****@*****.**");

            myLuceneApp.DisplayResults(topDocs);
            // clean up
            myLuceneApp.CleanUpSearcher();
            myLuceneApp.CleanUpIndexer();


            System.Console.ReadLine();
        }
Exemplo n.º 3
0
        public SearchCore(LuceneSearch luceneSearch, List <JournalArticle> articles)
        /*Main constructor for the search form*/
        {
            //Initialize components for search form
            InitializeComponent();
            LuceneSearch_app     = luceneSearch;
            Articles             = articles;
            search_query.Visible = false;

            //Initialize SearchFieldCB
            SearchFieldCB.Items.Add(new FieldSelectItem(FIELD_ALL));
            SearchFieldCB.Items.Add(new FieldSelectItem(FIELD_TITLE));
            SearchFieldCB.Items.Add(new FieldSelectItem(FIELD_AUTHOR));
            SearchFieldCB.Items.Add(new FieldSelectItem(FIELD_BILI));
            SearchFieldCB.Items.Add(new FieldSelectItem(FIELD_WORD));
            SearchFieldCB.SelectedIndex = 0;
        }
Exemplo n.º 4
0
        private void IndexDocuments()
        {
            textBox.AppendText("Start indexing ...\n");
            DateTime start = System.DateTime.Now;

            luceneSearch = new LuceneSearch();

            string indexPath = indexPathLabel.Text;

            luceneSearch.CreateIndex(indexPath);
            System.Console.WriteLine("Adding Documents to Index");
            foreach (JournalArticle article in articles)
            {
                luceneSearch.IndexText(article.Words);
            }
            DateTime end = System.DateTime.Now;

            System.Console.WriteLine("All documents added.");
            textBox.AppendText("All documents added.\n");
            textBox.AppendText("The indexing lasted for " + (end - start) + "\n");
            nextBtn.Enabled = true;
        }
Exemplo n.º 5
0
 public MainForm(LuceneSearch luceneSearch)
 {
     InitializeComponent();
     LuceneSearch = luceneSearch;
 }