public int GetMaxSourceID() { using (SearcherManager manager = new SearcherManager(SourceIndexWriterSingleton.Instance)) { this.searcher = manager.Acquire().Searcher; Query query = NumericRangeQuery.NewIntRange("Id", 1, int.MaxValue, true, true); this.topDocs = this.searcher.Search(query, null, 1, new Sort(new SortField("Id", SortField.INT, true))); if (this.topDocs != null && this.topDocs.ScoreDocs != null && this.topDocs.ScoreDocs.Length > 0) { ScoreDoc scoreDoc = this.topDocs.ScoreDocs[0]; LuceneSearchResult result = new LuceneSearchResult(this.searcher.Doc(scoreDoc.Doc), scoreDoc.Score, this.topDocs.TotalHits); int id = 0; if (result.FieldValues != null && result.FieldValues["Id"] != null && result.FieldValues["Id"].Count > 0 && int.TryParse(result.FieldValues["Id"][0], out id)) { return(id); } } } return(0); }
public EventDataTableView(LuceneSearchResult result) { if (result != null) { if (result.FieldValues.ContainsKey("Id")) { foreach (string s in result.FieldValues["Id"]) { int i; if (int.TryParse(s, out i)) { this.Id = i; } } } if (result.FieldValues.ContainsKey("JhroCaseNumber")) { IList <string> codes = result.FieldValues["JhroCaseNumber"] as IList <string>; if (codes != null) { this.JhroCaseNumber = string.Join("; ", codes); } } if (result.FieldValues.ContainsKey("Violation")) { IList <string> violations = result.FieldValues["Violation"] as IList <string>; if (violations != null) { this.Violations = string.Join("<br />", violations); } } if (result.FieldValues.ContainsKey("StartDateDisplay")) { foreach (string s in result.FieldValues["StartDateDisplay"]) { this.StartDateDisplay = s; } } if (result.FieldValues.ContainsKey("EndDateDisplay")) { foreach (string s in result.FieldValues["EndDateDisplay"]) { this.EndDateDisplay = s; } } if (result.FieldValues.ContainsKey("Location")) { foreach (string s in result.FieldValues["Location"]) { this.Location = s; } } } }
public SourcePathDataTableLuceneView(LuceneSearchResult result) { if (result.FieldValues.ContainsKey("Id")) { foreach (string s in result.FieldValues["Id"]) { this.Id = s; } } if (result.FieldValues.ContainsKey("SourceName")) { foreach (string s in result.FieldValues["SourceName"]) { this.Name = s; } } if (result.FieldValues.ContainsKey("SourcePath")) { foreach (string s in result.FieldValues["SourcePath"]) { this.Path = s; } } if (result.FieldValues.ContainsKey("IsRestricted")) { foreach (string s in result.FieldValues["IsRestricted"]) { this.IsRestricted = string.Equals(s, "1"); } } if (result.FieldValues.ContainsKey("FileDateTimeStamp")) { foreach (string s in result.FieldValues["FileDateTimeStamp"]) { this.FileDateTimeStamp = new DateTime(long.Parse(s)); } } if (result.FieldValues.ContainsKey("FileSize")) { foreach (string s in result.FieldValues["FileSize"]) { this.FileSize = long.Parse(s); } } if (result.FieldValues.ContainsKey("JhroCaseNumber")) { foreach (string s in result.FieldValues["JhroCaseNumber"]) { this.JhroCaseNumber = s; } } }
public PersonDataTableLuceneView(LuceneSearchResult result) { if (result.FieldValues.ContainsKey("Id")) { foreach (string s in result.FieldValues["Id"]) { this.Id = s; } } if (result.FieldValues.ContainsKey("Name")) { this.Name = result.FieldValues["Name"] as IList <string>; } if (result.FieldValues.ContainsKey("MilitaryIDNumber")) { this.MilitaryIDNumber = result.FieldValues["MilitaryIDNumber"].ToList <string>(); } if (result.FieldValues.ContainsKey("Rank")) { foreach (string s in result.FieldValues["Rank"]) { this.Rank = s; } } if (result.FieldValues.ContainsKey("Function")) { foreach (string s in result.FieldValues["Function"]) { this.Function = s; } } }
public UnitDataTableLuceneView(LuceneSearchResult result) { if (result.FieldValues.ContainsKey("Id")) { foreach (string s in result.FieldValues["Id"]) { this.Id = s; } } if (result.FieldValues.ContainsKey("Name")) { IList <string> names = result.FieldValues["Name"] as IList <string>; if (names != null && names.Any()) { // this assumes that the first is the original name this.Name = names.First(); this.Aliases = names.Skip(1).ToList(); } } if (result.FieldValues.ContainsKey("ParentNameChange")) { this.ParentNames = result.FieldValues["ParentNameChange"] as IList <string>; } if (result.FieldValues.ContainsKey("ChildNameChange")) { this.ChildNames = result.FieldValues["ChildNameChange"] as IList <string>; } if (result.FieldValues.ContainsKey("BackgroundInformation")) { foreach (string s in result.FieldValues["BackgroundInformation"]) { if (!string.IsNullOrEmpty(s)) { this.BackgroundInformation = s.Replace("\r\n", "<br />").Replace("\n", "<br />"); } } } if (result.FieldValues.ContainsKey("Organization")) { foreach (string s in result.FieldValues["Organization"]) { this.Organization = s; } } if (result.FieldValues.ContainsKey("StartDateDisplay")) { foreach (string s in result.FieldValues["StartDateDisplay"]) { this.StartDateDisplay = s; } } if (result.FieldValues.ContainsKey("EndDateDisplay")) { foreach (string s in result.FieldValues["EndDateDisplay"]) { this.EndDateDisplay = s; } } }
public ScreeningResponseDataTableLuceneView(LuceneSearchResult result) { if (result.FieldValues.ContainsKey("PersonId")) { foreach (string s in result.FieldValues["PersonId"]) { this.PersonId = s; } } if (result.FieldValues.ContainsKey("PersonName")) { foreach (string s in result.FieldValues["PersonName"]) { this.PersonName = s; } } if (result.FieldValues.ContainsKey("ScreeningEntityName")) { foreach (string s in result.FieldValues["ScreeningEntityName"]) { this.ScreeningEntityName = s; } } if (result.FieldValues.ContainsKey("LastColourCoding")) { foreach (string s in result.FieldValues["LastColourCoding"]) { this.LastColourCoding = s; } } if (result.FieldValues.ContainsKey("LastScreeningResult")) { foreach (string s in result.FieldValues["LastScreeningResult"]) { this.LastScreeningResult = s; } } if (result.FieldValues.ContainsKey("LastScreeningDate")) { foreach (string s in result.FieldValues["LastScreeningDate"]) { this.LastScreeningDate = new DateTime(long.Parse(s)); } } if (result.FieldValues.ContainsKey("Reason")) { foreach (string s in result.FieldValues["Reason"]) { this.Reason = s; } } if (result.FieldValues.ContainsKey("Commentary")) { foreach (string s in result.FieldValues["Commentary"]) { this.Commentary = s; } } }
public RequestDataTableLuceneView(LuceneSearchResult result) { if (result.FieldValues.ContainsKey("Id")) { foreach (string s in result.FieldValues["Id"]) { this.Id = s; } } if (result.FieldValues.ContainsKey("ReferenceNumber")) { foreach (string s in result.FieldValues["ReferenceNumber"]) { this.ReferenceNumber = s; } } if (result.FieldValues.ContainsKey("RequestName")) { foreach (string s in result.FieldValues["RequestName"]) { this.RequestName = s; } } if (result.FieldValues.ContainsKey("RequestEntity")) { foreach (string s in result.FieldValues["RequestEntity"]) { this.RequestEntity = s; } } if (result.FieldValues.ContainsKey("RequestType")) { foreach (string s in result.FieldValues["RequestType"]) { this.RequestType = s; } } if (result.FieldValues.ContainsKey("RespondByDateDisplay")) { foreach (string s in result.FieldValues["RespondByDateDisplay"]) { this.RespondBy = s; } } if (result.FieldValues.ContainsKey("RespondImmediately")) { foreach (string s in result.FieldValues["RespondImmediately"]) { if (string.Equals("1", s)) { this.RespondBy = "Immediately"; } } } if (result.FieldValues.ContainsKey("CurrentStatus")) { foreach (string s in result.FieldValues["CurrentStatus"]) { this.CurrentStatus = s; } } if (result.FieldValues.ContainsKey("CurrentStatusDateDisplay")) { foreach (string s in result.FieldValues["CurrentStatusDateDisplay"]) { this.CurrentStatusDate = s; } } if (result.FieldValues.ContainsKey("Persons")) { foreach (string s in result.FieldValues["Persons"]) { this.Persons = s; } } if (result.FieldValues.ContainsKey("Notes")) { foreach (string s in result.FieldValues["Notes"]) { this.Description = s; } } }
public SourceResultDataTableLuceneView(LuceneSearchResult result) { if (result.FieldValues.ContainsKey("Id")) { foreach (string s in result.FieldValues["Id"]) { this.Id = s; } } if (result.FieldValues.ContainsKey("SourceName")) { foreach (string s in result.FieldValues["SourceName"]) { this.SourceName = s; } } if (result.FieldValues.ContainsKey("SourcePath")) { foreach (string s in result.FieldValues["SourcePath"]) { this.SourcePath = s; } } if (result.FieldValues.ContainsKey("IsRestricted")) { foreach (string s in result.FieldValues["IsRestricted"]) { this.IsRestricted = string.Equals(s, "1"); } } if (result.FieldValues.ContainsKey("IsReadOnly")) { foreach (string s in result.FieldValues["IsReadOnly"]) { this.IsReadOnly = string.Equals(s, "1"); } } if (result.FieldValues.ContainsKey("IsPublic")) { foreach (string s in result.FieldValues["IsPublic"]) { this.IsReadOnly = string.Equals(s, "1"); } } if (result.FieldValues.ContainsKey("UploadedBy")) { foreach (string s in result.FieldValues["UploadedBy"]) { this.UploadedBy = s; } } if (result.FieldValues.ContainsKey("FileDateTimeStamp")) { foreach (string s in result.FieldValues["FileDateTimeStamp"]) { this.FileDateTimeStamp = new DateTime(long.Parse(s)); } } this.HighlightFragment = result.HighlightFragment; if (result.FieldValues.ContainsKey("Author")) { IList <string> authors = result.FieldValues["Author"] as IList <string>; if (authors != null) { this.Author = string.Join("<br />", authors); } } this.Score = result.Score; }