예제 #1
0
        public static List <ResultItem> SearchSubQueries(Db db, Db db_words, string query)
        {
            var results       = new List <ResultItem>();
            var words         = query.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).Take(5).ToList();
            var other_queries = new List <string>();

            for (int i = 0; i < words.Count(); i++)
            {
                var new_list = new List <string>();
                for (int j = 0; j < words.Count(); j++)
                {
                    if (i == j)
                    {
                        continue;
                    }
                    new_list.Add(words[j]);
                }
                var nq = new_list.Aggregate((a, b) => a + " " + b);
                other_queries.Add(nq);
            }
            foreach (var q in other_queries)
            {
                var tmp = SearchLogic.SearchTitles(db, db_words, q);
                results.AddRange(tmp);
            }
            foreach (var r in results)
            {
                r.Score += -50000;
            }
            return(results);
        }
예제 #2
0
 public static List <ResultItem> SearchTitles(string query)
 {
     Init();
     return(SearchLogic.SearchTitles(db, db_words, query));
 }