public EvaluationOutput(DateTime queryTime, string partialQuery, string fullQuery, AutoCompletionList autoCompletionList, int queryCount) { QueryTime = queryTime; PartialQuery = partialQuery; FullQuery = fullQuery; AutoCompletionList = autoCompletionList; QueryCount = queryCount; }
/// <summary> /// Use some heuristics to reduce the number of autocompletions that need to be sorted. /// Relies on the long tail and the max of the RankingWeights. /// </summary> /// <param name="autoCompletionList"></param> /// <returns></returns> public IEnumerable<AutoCompletion> GetTopAutoCompletions(AutoCompletionList autoCompletionList, int minQueryFrequency = 2) { TopNStructure<AutoCompletion> topNAutocompletions = new TopNStructure<AutoCompletion>(4); // Up to 4 completions suggested if (autoCompletionList.Count <= 4) { autoCompletionList.Sort(); return autoCompletionList; } foreach (AutoCompletion ac in autoCompletionList) { if (ac.RankingWeight < minQueryFrequency) continue; // Ignore; topNAutocompletions.Add(ac); } return topNAutocompletions; }
/// <summary> /// Queue the evaluation thread /// </summary> private void QueueEvaluationThread(DateTime queryTime, string partialQuery, string query, AutoCompletionList autoCompletionList) { EvaluationOutput eo = new EvaluationOutput(queryTime, partialQuery, query, autoCompletionList, _queryCount); if (_isConcurrent) _evalThreadPool.QueueWorkItem(_evalOutput.SortAndOutput, eo); else _evalOutput.SortAndOutput(eo); // Single-threaded only }
public void AddItem(AutoCompleteEntry entry) { AutoCompletionList.Add(entry); }