private void SearchStringStart() { Console.WriteLine("\tSearching String at Start"); var userInput = GetUserInput(); Console.WriteLine("Result: " + (SearchStart.SearchString(userInput))); }
//Search the repo for a list of pids that match a search term //This returns the results as a list of pairs of titles and pids //will eventually take a pagenum and other params for more advanced searching public List <SearchResult> AdvancedSearch(string mode, string terms, string key) { List <SearchResult> results = new List <SearchResult>(); List <FederateRecord> federates = mFederateRegister.GetAllFederateRecords(); List <System.Threading.Thread> threads = new List <System.Threading.Thread>(); foreach (FederateRecord fr in federates) { System.Threading.ParameterizedThreadStart ts = new System.Threading.ParameterizedThreadStart(AdvancedSearch1Delegate); System.Threading.Thread t = new System.Threading.Thread(ts); SearchStart ss = new SearchStart(); ss.terms = terms; ss.results = results; ss.mode = mode; ss.fed = fr; //Search1Delegate(ss); t.Start(ss); threads.Add(t); } bool done = false; int totalSleeps = 0; while (!done && totalSleeps < 30) { done = true; foreach (System.Threading.Thread t in threads) { if (t.IsAlive) { done = false; } } System.Threading.Thread.Sleep(300); totalSleeps++; } return(results); }
//Search the repo for a list of pids that match a search term //This returns the results as a list of pairs of titles and pids //will eventually take a pagenum and other params for more advanced searching public List <SearchResult> Search(string terms, string key) { List <SearchResult> results = new List <SearchResult>(); List <FederateRecord> federates = mFederateRegister.GetAllFederateRecords(); List <System.Threading.Thread> threads = new List <System.Threading.Thread>(); foreach (FederateRecord fr in federates) { System.Threading.ParameterizedThreadStart ts = new System.Threading.ParameterizedThreadStart(Search1Delegate); System.Threading.Thread t = new System.Threading.Thread(ts); SearchStart ss = new SearchStart(); ss.Authorization = WebOperationContext.Current.IncomingRequest.Headers["Authorization"]; ss.terms = terms; ss.results = results; ss.fed = fr; //Search1Delegate(ss); t.Start(ss); threads.Add(t); } bool done = false; int totalSleeps = 0; while (!done && totalSleeps < 30) { done = true; foreach (System.Threading.Thread t in threads) { if (t.IsAlive) { done = false; } } System.Threading.Thread.Sleep(300); totalSleeps++; } return(results); }
//Search the repo for a list of pids that match a search term //This returns the results as a list of pairs of titles and pids //will eventually take a pagenum and other params for more advanced searching public List<SearchResult> Search(string terms, string key) { List<SearchResult> results = new List<SearchResult>(); List<FederateRecord> federates = mFederateRegister.GetAllFederateRecords(); List<System.Threading.Thread> threads = new List<System.Threading.Thread>(); foreach (FederateRecord fr in federates) { System.Threading.ParameterizedThreadStart ts = new System.Threading.ParameterizedThreadStart(Search1Delegate); System.Threading.Thread t = new System.Threading.Thread(ts); SearchStart ss = new SearchStart(); ss.Authorization = WebOperationContext.Current.IncomingRequest.Headers["Authorization"]; ss.terms = terms; ss.results = results; ss.fed = fr; //Search1Delegate(ss); t.Start(ss); threads.Add(t); } bool done = false; int totalSleeps = 0; while (!done && totalSleeps < 30) { done = true; foreach (System.Threading.Thread t in threads) { if (t.IsAlive) done = false; } System.Threading.Thread.Sleep(300); totalSleeps++; } return results; }
//Search the repo for a list of pids that match a search term //This returns the results as a list of pairs of titles and pids //will eventually take a pagenum and other params for more advanced searching public List<SearchResult> AdvancedSearch(string mode, string terms, string key) { List<SearchResult> results = new List<SearchResult>(); List<FederateRecord> federates = mFederateRegister.GetAllFederateRecords(); List<System.Threading.Thread> threads = new List<System.Threading.Thread>(); foreach (FederateRecord fr in federates) { System.Threading.ParameterizedThreadStart ts = new System.Threading.ParameterizedThreadStart(AdvancedSearch1Delegate); System.Threading.Thread t = new System.Threading.Thread(ts); SearchStart ss = new SearchStart(); ss.terms = terms; ss.results = results; ss.mode = mode; ss.fed = fr; //Search1Delegate(ss); t.Start(ss); threads.Add(t); } bool done = false; int totalSleeps = 0; while (!done && totalSleeps < 30) { done = true; foreach (System.Threading.Thread t in threads) { if (t.IsAlive) done = false; } System.Threading.Thread.Sleep(300); totalSleeps++; } return results; }
public string GetSearchText() { return(SearchStart.CreateEditPoint().GetText(SearchEnd)); }
public Exercise4() { Search = new Search(); SearchStart = new SearchStart(); SearchEnd = new SearchEnd(); }