public HelixAnalyzerService(XmlNode configNode, IDataSourceLocation dataSourceLocation, ICerberusVariablesReplacer variablesReplacer) : base( variablesReplacer) { _dataSourceLocation = dataSourceLocation; if (configNode == null) { return; } var analyzers = GetAnalyzers(configNode, out var provider); _logProvider = GetLogContainer(configNode); foreach (var node in analyzers) { var ruleProvider = RegisterRules(node); var type = XmlActivator.GetType(node); if (type != null) { provider.Register(type, () => XmlActivator.CreateInstance(type, node, new[] { provider, ruleProvider, _logProvider }), true); if (provider.Resolve(type) is IHelixAnalyzer resolve) { Analyzers.Add(resolve); } } } }
public SolarSystem_Query() { Map = systems => from system in systems select new { Name = system.Name, NameExact = system.Name, NamePartial = system.Name, Economies = system.Stations.SelectMany(x => x.Economy).Distinct(), Factions = system.Factions.Select(x => x.Id), Attitude = system.Stations.Where(x => x.Main).Select(x => x.Faction.Attitude).FirstOrDefault(), HasAlly = system.Factions.Any(x => x.Attitude == FactionAttitude.Ally), HasCoordinates = (system.Coordinates != null && !(system.Coordinates.X == 0 && system.Coordinates.Y == 0 && system.Coordinates.Z == 0)), Supply = system.Stations.SelectMany(x => x.Commodities).Where(x => x.Supply != CommodityAvailability.None).Select(x => x.Type).Distinct(), Demand = system.Stations.SelectMany(x => x.Commodities).Where(x => x.Demand != CommodityAvailability.None).Select(x => x.Type).Distinct(), PowerPlayLeader = system.PowerPlayLeader, PowerPlayState = system.PowerPlayState, Outfitting = system.Stations.Select(x => x.Outfitting).Distinct(), Groups = system.Groups }; Indexes.Add(x => x.Name, Raven.Abstractions.Indexing.FieldIndexing.Analyzed); Indexes.Add(x => x.NameExact, Raven.Abstractions.Indexing.FieldIndexing.Default); Indexes.Add(x => x.NamePartial, Raven.Abstractions.Indexing.FieldIndexing.Analyzed); Analyzers.Add(x => x.NamePartial, "Xemio.RavenDB.NGramAnalyzer.NGramAnalyzer,Xemio.RavenDB.NGramAnalyzer"); }
public Companies_SortByName() { Map = companies => from company in companies select new { company.Name }; Analyzers.Add(c => c.Name, typeof(PlCollationAnalyzer).ToString()); }
public void RegisterAnalyzer(ISharperCryptoApiAnalysisAnalyzer analyzer) { var index = Analyzers.IndexOf(analyzer); if (index < 0) { ThreadHelper.Generic.BeginInvoke(() => Analyzers.Add(analyzer)); } else { ThreadHelper.Generic.BeginInvoke(() => Analyzers[index] = analyzer); } if (Settings.MutedAnalyzers.Contains((int)analyzer.AnalyzerId)) { analyzer.IsMuted = true; } foreach (var report in analyzer.SupportedReports) { if (report.Equals(AnalysisReport.EmptyReport)) { continue; } ThreadHelper.Generic.BeginInvoke(() => Reports.Add(report)); } }
/// <summary> /// /// </summary> /// <typeparam name="T"></typeparam> /// <returns></returns> public T AddAnalyzer <T>() where T : TextTokenAnalyzer, new() { var analayzer = new T(); Analyzers.Add(analayzer); return(analayzer); }
public Object_ByName() { Map = objects => objects.Select(x => new { x.Name }); Indexes.Add(x => x.Name, FieldIndexing.Analyzed); Analyzers.Add(x => x.Name, "Lucene.Net.Analysis.Standard.StandardAnalyzer"); }
public MessageDocument_Search() { Map = messageDocuments => from messageDocument in messageDocuments select new { Any = new Object[] { messageDocument.Body, messageDocument.MessageTypes.Select(x => x.ClassName), messageDocument.Headers.Select(x => x.Value), messageDocument.AdditionalErrorStatus, messageDocument.ApplicationId, messageDocument.Id }, messageDocument.Id, messageDocument.TimeSent, ClassName = messageDocument.MessageTypes.Select(x => x.ClassName), messageDocument.IsError, messageDocument.ApplicationId, Header = messageDocument.Headers.Select(x => x.Value), messageDocument.AdditionalErrorStatus }; Sort(x => x.Id, SortOptions.String); Index(x => x.Any, FieldIndexing.Analyzed); Analyzers.Add(x => x.Any, "StandardAnalyzer"); }
public GetMultipleStringFieldsIndex() { Map = entities => from entity in entities select new ReduceResult { StringA = entity.StringA, StringB = entity.StringB, StringC = entity.StringC, StringD = entity.StringD, Sum = 1 }; Reduce = results => from result in results group result by new { result.StringA, result.StringB, result.StringC, result.StringD } into g select new ReduceResult { StringA = g.First().StringA, StringB = g.First().StringB, StringC = g.First().StringC, StringD = g.First().StringD, Sum = g.Sum(x => x.Sum) }; Analyzers.Add(c => c.StringA, typeof(Lucene.Net.Analysis.Standard.StandardAnalyzer).ToString()); Analyzers.Add(c => c.StringB, typeof(Lucene.Net.Analysis.Standard.StandardAnalyzer).ToString()); Analyzers.Add(c => c.StringC, typeof(Lucene.Net.Analysis.Standard.StandardAnalyzer).ToString()); Analyzers.Add(c => c.StringD, typeof(Lucene.Net.Analysis.Standard.StandardAnalyzer).ToString()); Indexes.Add(x => x.StringA, FieldIndexing.Search); Indexes.Add(x => x.StringB, FieldIndexing.Search); Indexes.Add(x => x.StringC, FieldIndexing.Search); Indexes.Add(x => x.StringD, FieldIndexing.Search); }
public Companies_CustomAnalyzers() { Map = companies => from company in companies select new { company.Name, company.Desc, company.Email, company.Address1, company.Address2, company.Address3, company.Phone }; Analyzers.Add(c => c.Name, typeof(Lucene.Net.Analysis.Standard.StandardAnalyzer).ToString()); Analyzers.Add(c => c.Desc, typeof(Lucene.Net.Analysis.StopAnalyzer).ToString()); Analyzers.Add(c => c.Email, typeof(Lucene.Net.Analysis.StopAnalyzer).ToString()); Analyzers.Add(c => c.Address1, typeof(Lucene.Net.Analysis.SimpleAnalyzer).ToString()); Analyzers.Add(c => c.Address2, typeof(Lucene.Net.Analysis.WhitespaceAnalyzer).ToString()); Analyzers.Add(c => c.Address3, typeof(Lucene.Net.Analysis.KeywordAnalyzer).ToString()); Analyzers.Add(c => c.Phone, typeof(Lucene.Net.Analysis.Standard.StandardAnalyzer).ToString()); Stores.Add(c => c.Name, FieldStorage.Yes); Stores.Add(c => c.Desc, FieldStorage.Yes); Indexes.Add(c => c.Email, FieldIndexing.NotAnalyzed); TermVectors.Add(c => c.Name, FieldTermVector.WithPositionsAndOffsets); }
public SampleIndex2() { Map = users => from doc in users select new { doc.Name }; Sort(x => x.Name, SortOptions.String); Analyzers.Add(x => x.Name, "Raven.Database.Indexing.Collation.Cultures.SvCollationAnalyzer, Raven.Database"); }
public Companies_SortByName() { Map = companies => from company in companies select new { company.Name }; Sort(c => c.Name, SortOptions.String); Analyzers.Add(c => c.Name, typeof(Raven.Database.Indexing.Collation.Cultures.PlCollationAnalyzer).ToString()); }
public void AddAnalyser(string id, string tokenizer, string filter) { CustomAnalyzer custom = new CustomAnalyzer(); var filters = filter.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); custom.Filter = filters; custom.Tokenizer = tokenizer; Analyzers.Add(id, custom); }
public Records_ByData() { Map = records => from record in records select new { record.DataSourceId, record.Data }; Indexes.Add(x => x.Data, FieldIndexing.Analyzed); Analyzers.Add(x => x.Data, typeof(SimpleAnalyzer).AssemblyQualifiedName); }
public Users_ByName() { Map = users => from u in users select new { u.Name }; Analyzers.Add(x => x.Name, "NotExistingAnalyzer"); }
public ImageByName() { Map = docs => from i in docs select new { Id = i.Id, Name = new[] { i.Name }, }; Index(r => r.Name, FieldIndexing.Search); Analyzers.Add(n => n.Name, nameof(NGramAnalyzer)); }
public ImageByName() { Map = docs => from i in docs select new { Id = i.Id, Name = new[] { i.Name }, }; Index(r => r.Name, FieldIndexing.Analyzed); Analyzers.Add(n => n.Name, typeof(NGramAnalyzer).AssemblyQualifiedName); }
public Articles_ByArticleBody() { Map = docs => from doc in docs select new { doc.ArticleBody }; Stores.Add(x => x.ArticleBody, FieldStorage.Yes); Analyzers.Add(x => x.ArticleBody, "StandardAnalyzer"); }
public MyIndex(string analyzerName) { Map = customers => from customer in customers select new { Name = customer.Name }; Indexes.Add(x => x.Name, FieldIndexing.Search); Analyzers.Add(x => x.Name, analyzerName); }
public Index_With_NGram_Analyzer() { Map = companies => from c in companies select new { Name = c.Name }; Index(r => r.Name, FieldIndexing.Search); Analyzers.Add(n => n.Name, nameof(NGramAnalyzer)); }
public MyDocIndex() { Map = docs => docs.Select( lm => new MyDocResult() { Message = lm.Message, IsChange = (lm.Type & LogTypeEnum.Changes) == LogTypeEnum.Changes }); Analyzers.Add(lm => lm.Message, "Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net"); }
public void FillDictData(string[] namesArr, FieldStorage[] storesArr, string[] analArr, SuggestionOptions[] sugArr) { for (int i = 0; i < namesArr.Length; i++) { Fields.Add(namesArr[i]); Stores.Add(namesArr[i], storesArr[i]); Analyzers.Add(namesArr[i], analArr[i]); Suggestions.Add(namesArr[i], sugArr[i]); } }
public CategoryDescription() { Map = categories => from category in categories select new { category.Description }; Stores.Add(x => x.Description, FieldStorage.Yes); Analyzers.Add(x => x.Description, "Lucene.Net.Analysis.Standard.StandardAnalyzer"); }
public Users_ByName() { Map = users => from u in users select new { Name = u.Name, LastName = u.LastName.Boost(10) }; Indexes.Add(x => x.Name, FieldIndexing.Analyzed); IndexSuggestions.Add(x => x.Name, new SuggestionOptions()); Analyzers.Add(x => x.Name, typeof(SimpleAnalyzer).FullName); Stores.Add(x => x.Name, FieldStorage.Yes); }
public DeCollationIndex() { Map = contacts => from contact in contacts select new { contact.FirstName, }; Analyzers.Add(x => x.FirstName, typeof(DeCollationAnalyzer).AssemblyQualifiedName); Sort(x => x.FirstName, SortOptions.String); }
public Posts_ByPostCategory() { Map = docs => from doc in docs select new { doc.Body, doc.Category }; Stores.Add(x => x.Body, FieldStorage.Yes); Analyzers.Add(x => x.Body, typeof(StandardAnalyzer).FullName); }
public Users_ByName() { Map = users => from u in users select new { Name = u.Name, LastName = u.LastName.Boost(10) }; Indexes.Add(x => x.Name, FieldIndexing.Search); IndexSuggestions.Add(x => x.Name); Analyzers.Add(x => x.Name, typeof(Lucene.Net.Analysis.SimpleAnalyzer).FullName); Stores.Add(x => x.Name, FieldStorage.Yes); }
public UserIndex() { Map = users => from user in users select new { user.Name, user.Total, user.Role }; Indexes.Add(x => x.Name, FieldIndexing.Analyzed); Analyzers.Add(x => x.Name, typeof(TurkishAnalyzer.TurkishAnalyzer).AssemblyQualifiedName); }
public Audio_Index() { // audio properties Map = audios => from audio in audios select new { Id = audio.Id, AudioId = audio.Id, Name = audio.Name }; Analyzers.Add(x => x.Name, "SimpleAnalyzer"); }
public Students_WithFriends() { Map = students => from student in students let friends = LoadDocument <Student>(student.Friends) select new Mapping { EmailDomain = student.Email.Split('@', StringSplitOptions.None).Last(), Friends = friends.Select(a => a.Email) }; Analyzers.Add(x => x.Friends, "Lucene.Net.Analysis.SimpleAnalyzer, Lucene.Net"); Indexes.Add(x => x.Friends, FieldIndexing.Search); }
public ZC_CountryCityStateCodeACIndex() { Map = sEnum => sEnum .Select(t => new { t.CountryCode, CityOrder = t.City, t.City, t.StateCode }); Reduce = results => results .GroupBy(r => new { r.City, r.CountryCode, r.StateCode }) .Select(g => new { g.Key.City, CityOrder = g.Key.City, g.Key.CountryCode, g.Key.StateCode }); //Bug Collation - following resolves in empty results //Without it, {ä ö ü} are analyzed wrongly and are placed at the end of the alphabet Analyzers.Add(x => x.CityOrder, typeof(DeCollationAnalyzer).AssemblyQualifiedName); }