コード例 #1
0
ファイル: Log.cs プロジェクト: zeferreira/eDoc
 public Log()
 {
     this.engConf = EngineConfiguration.Instance;
     this.separator = engConf.LogSeparator;
     this.separatorParameters = '#';
     this.LogParameters = new List<string>();
 }
コード例 #2
0
ファイル: EngineDisk.cs プロジェクト: zeferreira/eDoc
 EngineDisk()
 {
     this.engineConfiguration = EngineConfiguration.Instance;
     this.logRep = FactoryRepositoryLog.GetRepositoryLog();
     maxSentence = engineConfiguration.MaxSentence;
     maxResultList = engineConfiguration.MaxResultList;
     this.indexer = FactoryIndexer.GetIndexer();
 }
コード例 #3
0
        RankFunctionPivotedLengthNormVSM()
        {
            this.engConf = EngineConfiguration.Instance;
            this.docIndex = FactoryDocumentIndex.GetDocumentIndex();
            
            this.s = engConf.SNormalizationfactor;

            this.totalDocQuantity = docIndex.GetQuantity();

            this.avdl = docIndex.GetAverageDocumentLenght();
        }
コード例 #4
0
        RankFunctionBM25_Okapi()
        {
            this.engConf = EngineConfiguration.Instance;
            this.docIndex = FactoryDocumentIndex.GetDocumentIndex();
            
            this.b = engConf.BNormalizationfactor;
            this.k1 = engConf.BM25OkapiK1factor;
            this.k3 = engConf.BM25OkapiK3factor;
            this.totalDocQuantity = docIndex.GetQuantity();

            this.avdl = docIndex.GetAverageDocumentLenght();
        }
コード例 #5
0
ファイル: RankFunctionBM25.cs プロジェクト: zeferreira/eDoc
 RankFunctionBM25()
 {
     this.engConf = EngineConfiguration.Instance;
     this.docIndex = FactoryDocumentIndex.GetDocumentIndex();
     this.totalDocQuantity = docIndex.GetQuantity();
 }
コード例 #6
0
        private string GetFileName(int wordID)
        {
            conf = EngineConfiguration.Instance;

            return conf.PathFolderIndex + @"\" + wordID.ToString() + ".ind";
        }
コード例 #7
0
ファイル: EngineController.cs プロジェクト: zeferreira/eDoc
        private List<DocumentResult> Search(string query, ResultSearchModel model)
        {
            IRepositoryLog repLog = FactoryRepositoryLog.GetRepositoryLog();

            engConf = EngineConfiguration.Instance;
            IEngine eng = FactoryEngine.GetEngine();
            DateTime start;
            TimeSpan timeDif;
            Stopwatch sw;

            string smsSearch = "Search".PadRight(15);

            start = DateTime.Now;
            sw = Stopwatch.StartNew();
            List<DocumentResult> result = eng.Search(query);
            sw.Stop();
            timeDif = sw.Elapsed;

            Log entry = new Log();
            entry.TaskDescription = smsSearch;
            entry.StartDateTime = start;
            entry.ExecutionTime = timeDif;
            entry.LogParameters = new List<string>();
            entry.LogParameters.Add("sentence: " + query);
            entry.LogParameters.Add("totalDocFound: " + result.Count.ToString());
            entry.LogParameters.Add("totalDocIndexed: " + eng.TotalDocumentQuantity.ToString());
            entry.LogParameters.Add("RankTypeFunction: " + engConf.RankTypeFunction);

            if (model.start == 0)
            {
                repLog.Write(entry);
            }

            if (result.Count > 0)
            {
                if (model.start == 0)
                {
                    WriteResultsToDisk(result, query);
                }

                foreach (DocumentResult item in result)
                {
                    string physicalRepositoryPath = EngineConfiguration.Instance.PathFolderRepository;
                    string virtualRepositoryParh = ConfigurationManager.AppSettings["pathVirtualRepository"] as string;

                    string resultPath = item.File.Remove(0, physicalRepositoryPath.Length);

                    resultPath = virtualRepositoryParh + resultPath.Replace("\\", "/");

                    resultPath = GetEncodedString(resultPath);

                    string baseUrl = Request.Url.Scheme + "://" + Request.Url.Authority + Request.ApplicationPath.TrimEnd('/') + "/";

                    if (String.IsNullOrEmpty(item.Url))
                    {
                        item.Url = baseUrl+ resultPath;
                    }
                }
            }
            return result;
        }