コード例 #1
0
ファイル: SearchGraph.cs プロジェクト: 1aurent/DataSearch
        static public SearchGraph Create(Engine parent, EngineSearchOptions options, IEnumerator <MatchData> searchResults)
        {
            var graph = new SearchGraph(parent, options);

            while (searchResults.MoveNext())
            {
                graph.AddNode(0, searchResults.Current.Domain, searchResults.Current.Item);
            }

            return(graph);
        }
コード例 #2
0
        public EngineSearchResults Search(EngineSearchOptions options, string searchText)
        {
            if (options.UseTextOnlySearch)
            {
                var simple = new EngineSearchResults {
                    TabularData = SearchBasic(searchText)
                };
                return(simple);
            }

            SearchGraph graph;

            NotifyStepToClient("Searching text in database");
            using (var matchData = _proxy.SearchText(searchText))
            {
                graph = SearchGraph.Create(this, options, matchData);
            }
            log.InfoFormat("Raw Search results - Total nodes: {0}", graph.TotalNodes);

            for (var i = 0; i < options.MaxNumberOfGeneration; ++i)
            {
                var status = string.Format("Processing Generation {0} ({1} results so far)", i + 1, graph.TotalNodes);
                NotifyStepToClient(status);
                using (new Timer(status))
                {
                    if (!graph.ExtendChart(i == 0))
                    {
                        log.Info("No more node issued or reached limit ... stop chart");
                        break;
                    }
                }
                log.InfoFormat("Generation {0} - Total nodes: {1}", i, graph.TotalNodes);
            }

            NotifyStepToClient(string.Format("Calculating HITS on {0} nodes", graph.TotalNodes));
            graph.ComputeHITS();
            NotifyStepToClient("Fetching results ...");
            var result = new EngineSearchResults {
                TabularData = graph.CreateTabularResult()
            };

            if (options.ReportSearchGraph)
            {
                NotifyStepToClient("Dumping search chart ...");
                result.SearchGraph = graph.CreateGraphDump();
            }
            return(result);
        }
コード例 #3
0
ファイル: SearchGraph.cs プロジェクト: 1aurent/DataSearch
 private SearchGraph(Engine parent, EngineSearchOptions options)
 {
     _parent  = parent;
     _options = options;
 }