Esempio n. 1
0
        public void BuildSearchEngine()
        {
            mySearchEngine = new SearchEngine(
                GlobalParameter.indexPath,
                GlobalParameter.indexMapPath,
                GlobalParameter.indexLengthPath,
                docCount,
                "..//..//Resources//");

            mySearchEngine2 = new SearchEngineASCII(
                GlobalParameter.indexPathvi,
                GlobalParameter.indexMapPathvi,
                GlobalParameter.indexLengthPathvi,
                docCount,
                "..//..//Resources//");
        }
Esempio n. 2
0
        public void BuildBothIndexerAndSearchEngine()
        {
            myIndexer  = new Indexer(new SPIMIndexer(resourcePath));
            myIndexer2 = new Indexer(new SPIMIndexerViASCII(resourcePath));
            docCount   = myIndexer.Index();

            mySearchEngine = new SearchEngine(
                GlobalParameter.indexPath,
                GlobalParameter.indexMapPath,
                GlobalParameter.indexLengthPath,
                docCount,
                "..//..//Resources//");

            myIndexer2.Index();

            mySearchEngine2 = new SearchEngineASCII(
                GlobalParameter.indexPathvi,
                GlobalParameter.indexMapPathvi,
                GlobalParameter.indexLengthPathvi,
                docCount,
                "..//..//Resources//");
        }
Esempio n. 3
0
        public List <SearchResult> ExpandQuery(string query, int[] items)
        {
            SearchEngine chosenSearchEngine = ChooseApproriateSearchEngine(query);
            // Search and output the result
            List <KeyValuePair <int, double> > result = chosenSearchEngine.ExpandQuery(query, items);

            List <SearchResult> returnresult = new List <SearchResult>();

            if (result.Count > 0)
            {
                // Display the ranked list
                for (int i = 0; i < result.Count; ++i)
                {
                    returnresult.Add(new SearchResult(docPaths[result[i].Key], result[i].Value));
                }
            }
            else
            {
                Console.WriteLine("Result: Not found!");
            }
            return(returnresult);
        }
Esempio n. 4
0
        public void BuildBothIndexerAndSearchEngine()
        {
            myIndexer = new Indexer(new SPIMIndexer(resourcePath));
            myIndexer2 = new Indexer(new SPIMIndexerViASCII(resourcePath));
            docCount = myIndexer.Index();

            mySearchEngine = new SearchEngine(
                GlobalParameter.indexPath,
                GlobalParameter.indexMapPath,
                GlobalParameter.indexLengthPath,
                docCount,
                "..//..//Resources//");

            myIndexer2.Index();

            mySearchEngine2 = new SearchEngineASCII(
                GlobalParameter.indexPathvi,
                GlobalParameter.indexMapPathvi,
                GlobalParameter.indexLengthPathvi,
                docCount,
                "..//..//Resources//");
        }