public HttpResponseMessage GetAllAnalysers() { try { var analyserKeys = ExamineInspectorHelper.GetAnalyzerKeys(); return(Request.CreateResponse(HttpStatusCode.OK, analyserKeys)); } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.ToString())); } }
private static Analyzer AnalyzerFromName(string analyzerName) { var analyzerType = (Type)ExamineInspectorHelper.GetAnalyzers()[analyzerName]; if (analyzerType == null) { var analyzer = Assembly.GetAssembly(typeof(Analyzer)); analyzerType = analyzer.GetType(analyzerName); } return((Analyzer)Activator.CreateInstance(analyzerType)); }
public IEnumerable <string> Analyse(string analyser, string textToAnalyse) { var analysers = ExamineInspectorHelper.GetAnalyzers(); var analyserObject = (Analyzer)Activator.CreateInstance((Type)analysers[analyser]); var tokenList = new List <string>(); var tokenStream = analyserObject.TokenStream("Analyze", new StringReader(textToAnalyse)); var token = tokenStream.Next(); while (token != null) { tokenList.Add(token.TermText()); token = tokenStream.Next(); } return(tokenList); }
public LuceneIndexSummary GetIndexSummary() { if (string.IsNullOrEmpty(_indexPath)) { LogHelper.Info(GetType(), "_indexPath is empty"); throw new Exception("Invalid index"); } var summary = new LuceneIndexSummary { NoOfDocuments = _reader.MaxDoc(), NoOfTerms = ExamineInspectorHelper.GetTermCount(_reader), NumberOfFields = _reader.GetFieldNames(IndexReader.FieldOption.ALL).Count, Fields = _reader.GetFieldNames(IndexReader.FieldOption.ALL), IndexFiles = GetIndexFiles() }; return(summary); }