Exemplo n.º 1
0
 public SearchLog(WorkingData wd, ISearch isp)
 {
     Plugins = isp;
     Config = wd.Config;
     Log = wd.Log;
     Station = new List<StationData>();
 }
Exemplo n.º 2
0
 public static QueryResult ConvertToDto(ISearch search)
 {
     using (search)
     {
         return Mapper.Map<ISearch, QueryResult>(search);
     }
 }
Exemplo n.º 3
0
 public void Init(ISearch view)
 {
     _view = view;
     _accountRepository = new SPKTCore.Core.DataAccess.Impl.AccountRepository();
     _profileRepository = new SPKTCore.Core.DataAccess.Impl.ProfileRepository();
     _redirector = new SPKTCore.Core.Impl.Redirector();
 }
Exemplo n.º 4
0
        void AddSearch(ISearch target)
        {
            target.Id = Guid.NewGuid();
            target.CreatedOnUtc = System.DateTime.UtcNow;

            var search = new Search();
            search.Id = target.Id;
            search.CreatedOnUtc = target.CreatedOnUtc;
            search.SearchName = target.SearchName;
            target.SearchTerms.ForEach(x =>
            {
                x.Id = Guid.NewGuid();
                x.CreatedOnUtc = System.DateTime.UtcNow;
                search.SearchTerms.Add(new SearchTerm
                {
                    CreatedOnUtc = x.CreatedOnUtc,
                    Id = x.Id,
                    Score = x.Score,
                    Term = x.Term
                });
            });
            using (var ctx = new SearcherEntities())
            {
                ctx.Searches.Add(search);
                ctx.SaveChanges();
            }
        }
Exemplo n.º 5
0
 public static ISearch<CustomerDto> GetCustomerSearch()
 {
     if (CutomerSearch == null)
     {
         CutomerSearch = new CustomerController();
     }
     return CutomerSearch;
 }
Exemplo n.º 6
0
 public Storage(string url, GUI owner)
 {
     this.PStorage = new PhysicalXML(Util.BASEURL + "\\" + url);
     this.SongList = this.PStorage.getSongs();
     this.owner = owner;
     // this.search = new Search();
     this.search = new IndexSearch(this.SongList.Values); // lucene searcher!
     Util.NRSONGS = this.SongList.Count;
 }
Exemplo n.º 7
0
 private void MeasureSearchAlgorithm(ISearch searcher, int[] array, int x)
 {
     Trace.WriteLine("Search type: " + searcher.GetType().Name);
     Trace.WriteLine("Item to find: " + x);
     var stopwatch = Stopwatch.StartNew();
     searcher.Search(array, x);
     stopwatch.Stop();
     Trace.WriteLine("Result time: " + stopwatch.Elapsed);
 }
Exemplo n.º 8
0
 public void SaveSearch(ISearch search)
 {
     if (search.SearchTerms.GroupBy(x => x.Term).Any(x => x.Count() > 1))
         throw new System.InvalidOperationException("Cannot add duplicate terms to search");
     //throw new NotImplementedException();
     if (search.Id == Guid.Empty)
         AddSearch(search);
     else
         UpdateSearch(search);
 }
Exemplo n.º 9
0
 public SearchViewModel(ISearch search)
 {
     _search = search;
     _search.FilterChanged += delegate { };
     _uniqueLocations = new HashSet<Tuple<int, int>>();
     ((INotifyCollectionChanged)_search.Results).CollectionChanged += OnResultsCollectionChanged;
     _search.CurrentResultChanged += Search_CurrentResultChanged;
     _items = new ObservableCollection<SearchResultItemViewModel>();
     OnPropertyChanged("Items");
 }
Exemplo n.º 10
0
 public UserRepository(IUsersDetails userDetails, ISPList spList, IOptions<ListNames> listNames, IOptions<CamlQueries> camlQueries,
     IOptions<MatterSettings> matterSettings, ISearch search)
 {
     this.userDetails = userDetails;
     this.spList = spList;
     this.matterSettings = matterSettings.Value;
     this.camlQueries = camlQueries.Value;
     this.search = search;
     this.listNames = listNames.Value; 
 }
Exemplo n.º 11
0
        internal static ILink Get(ISession session, IntPtr handle, ISearch search = null)
        {
            lock (_instanceLock)
            {
                NativeLink instance;

                if (!_instances.TryGetValue(handle, out instance))
                {
                    LinkType type;
                    lock (Spotify.Mutex)
                    {
                        type = Spotify.sp_link_type(handle);
                    }

                    switch (type)
                    {
                        case LinkType.Track:
                            instance = new NativeTrackAndOffsetLink(session, handle);
                            break;
                        case LinkType.Album:
                            instance = new NativeAlbumLink(session, handle);
                            break;
                        case LinkType.Artist:
                            instance = new NativeArtistLink(session, handle);
                            break;
                        case LinkType.Search:
                            instance = new NativeSearchLink(session, handle, search);
                            break;
                        case LinkType.Playlist:
                            instance = new NativePlaylistLink(session, handle);
                            break;
                        case LinkType.Profile:
                            instance = new NativeUserLink(session, handle);
                            break;
                        case LinkType.Starred:
                            instance = new NativePlaylistLink(session, handle);
                            break;
                        case LinkType.LocalTrack:
                            instance = new NativeTrackAndOffsetLink(session, handle);
                            break;
                        case LinkType.Image:
                            instance = new NativeImageLink(session, handle);
                            break;
                        default:
                            throw new ArgumentException("Invalid link.");
                    }

                    _instances.Add(handle, instance);
                    instance.Initialize();
                }

                return instance;
            }
        }
Exemplo n.º 12
0
 public AsynchronousSearch(
     string promptName
     , string parameterName
     , IChildPromptItemsService childPromptItemsService
     , ISearch search)
 {
     _search = search;
     _childPromptItemsService = childPromptItemsService;
     _parameterName = parameterName;
     _promptName = promptName;
 }
Exemplo n.º 13
0
 public Search(ISearch search)
 {
     Albums = search.Albums.Select(x => new Album(x)).ToArray();
     Artists = search.Artists.Select(x => new Artist(x)).ToArray();
     DidYouMean = search.DidYouMean;
     Query = search.Query;
     TotalAlbums = search.TotalAlbums;
     TotalArtists = search.TotalArtists;
     TotalTracks = search.TotalTracks;
     Tracks = search.Tracks.Select(x => new Track(x)).ToArray();
 }
Exemplo n.º 14
0
        public Search(ISearch search, Dispatcher dispatcher)
        {
            _dispatcher = dispatcher;
            _albums = new NotifyCollection<ITorshifyAlbum>();
            _artists = new NotifyCollection<ITorshifyArtist>();
            _tracks = new NotifyCollection<ITorshifyTrack>();

            InternalSearch = search;

            if (!InternalSearch.IsComplete)
            {
                InternalSearch.Completed += OnSearchCompleted;
            }
        }
Exemplo n.º 15
0
        public void SaveSearch(ISearch search)
        {
            var searchData = new Dictionary<string, string>
            {
                {"startTime", search.StartTime.Ticks.ToString()},
                {"endTime", search.EndTime.Ticks.ToString()},
                {"processedFilesCount", search.ProcessedFilesCount.ToString(CultureInfo.InvariantCulture)}
            };
            _sqLiteDatabase.Insert("[searches]", searchData);
            int searchID = int.Parse(_sqLiteDatabase.ExecuteScalar("SELECT seq FROM sqlite_sequence where name=\"searches\""));

            foreach (string phrase in search.Phrases)
            {
                var phraseData = new Dictionary<string, string>
                {
                    {"search_id", searchID.ToString(CultureInfo.InvariantCulture)},
                    {"phrase", phrase},
                };
                _sqLiteDatabase.Insert("[phrases]", phraseData);
            }

            foreach (MatchingFile file in search)
            {
                var fileData = new Dictionary<string, string>
                {
                    {"search_id", searchID.ToString(CultureInfo.InvariantCulture)},
                    {"fileName", file.FileName},
                    {"fullPath", file.FullPath},
                    {"sizeInBytes", file.SizeInBytes.ToString(CultureInfo.InvariantCulture)}
                };
                _sqLiteDatabase.Insert("[files]", fileData);
                int fileID = int.Parse(_sqLiteDatabase.ExecuteScalar("SELECT seq FROM sqlite_sequence where name=\"files\""));

                foreach (Match match in file.Matches)
                {
                    var matchData = new Dictionary<string, string>
                    {
                        {"file_id", fileID.ToString(CultureInfo.InvariantCulture)},
                        {"[index]", match.Index.ToString(CultureInfo.InvariantCulture)},
                        {"value", match.Value},
                    };
                    _sqLiteDatabase.Insert("[matches]", matchData);
                }
            }
        }
Exemplo n.º 16
0
        private void OnNewSearch(ISearch search)
        {
            RemoveAllRanges();
            if(_currentSearch != null)
            {
                ((INotifyCollectionChanged)_currentSearch.Results).CollectionChanged -= Results_CollectionChanged;
                _currentSearch.CurrentResultChanged -= SearchCurrentResultChanged;
            }

            _currentSearch = search;
            ((INotifyCollectionChanged)_currentSearch.Results).CollectionChanged += Results_CollectionChanged;
            _currentSearch.CurrentResultChanged += SearchCurrentResultChanged;
            foreach (ISearchResult result in _currentSearch.Results)
            {
                OnNewResult(result);
            }
            SearchCurrentResultChanged(this, EventArgs.Empty);
        }
Exemplo n.º 17
0
 public bool cleanSearchIndex()
 {
     Cursor.Current = Cursors.WaitCursor;
     this.owner.Enabled = false;
     try
     {
         this.search = new IndexSearch(this.SongList.Values, true); // lucene searcher! (re-index!)
     }
     catch (Exception)
     {
         this.owner.Enabled = true;
         Cursor.Current = Cursors.Default;
         return false;
     }
     this.owner.Enabled = true;
     Cursor.Current = Cursors.Default;
     return true;
 }
        public void SaveSearch(ISearch search)
        {
            Stream stream;
            var bformatter = new BinaryFormatter();
            ICollection<ISearch> historySearches;

            if (File.Exists(FileName))
            {
                stream = File.Open(FileName, FileMode.Open);
                historySearches = (ICollection<ISearch>)bformatter.Deserialize(stream);
                stream.Close();
                stream = File.Open(FileName, FileMode.Create);
            }
            else
            {
                stream = File.Open(FileName, FileMode.Create);
                historySearches = new Collection<ISearch>();
            }
            historySearches.Add(search);

            bformatter.Serialize(stream, historySearches);
            stream.Close();
        }
Exemplo n.º 19
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="repo">The main repository</param>
        /// <param name="factory">The content factory</param>
        /// <param name="siteService">The site service</param>
        /// <param name="pageService">The page service</param>
        /// <param name="paramService">The param service</param>
        /// <param name="mediaService">The media service</param>
        /// <param name="cache">The optional model cache</param>
        /// <param name="search">The optional search service</param>
        public PostService(IPostRepository repo, IContentFactory factory, ISiteService siteService, IPageService pageService,
                           IParamService paramService, IMediaService mediaService, ICache cache = null, ISearch search = null)
        {
            _repo         = repo;
            _factory      = factory;
            _siteService  = siteService;
            _pageService  = pageService;
            _paramService = paramService;
            _mediaService = mediaService;
            _search       = search;

            if ((int)App.CacheLevel > 2)
            {
                _cache = cache;
            }
        }
Exemplo n.º 20
0
 public void RegisterSearch(ISearch search)
 {
     _searches.Add(search);
     _currentSearch = search;
 }
Exemplo n.º 21
0
        /// <param name='operations'>
        /// Reference to the Rg.ClientApp.ISearch.
        /// </param>
        /// <param name='term'>
        /// Required.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        public static async Task <SearchResults> GetByTermAsync(this ISearch operations, string term, CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            Microsoft.Rest.HttpOperationResponse <Rg.ClientApp.Models.SearchResults> result = await operations.GetByTermWithOperationResponseAsync(term, cancellationToken).ConfigureAwait(false);

            return(result.Body);
        }
Exemplo n.º 22
0
        public async Task <UsageDataTableResult> GetProgramUsageData(Guid telemetryKey, TelemetryItemTypes itemType
                                                                     , int skip, int take, IEnumerable <Tuple <string, bool> > sortBy, ISearch requestSearch
                                                                     , List <string> searchableColumns)
        {
            Program program = await this.portalContext.Programs.FirstOrDefaultAsync(x => x.TelemetryKey == telemetryKey).ConfigureAwait(false);

            if (program == null)
            {
                throw new ArgumentException($"Program with key {telemetryKey} does not exist");
            }

            IQueryable <TelemetryDetail> query;
            int totalCount;

            if (itemType == TelemetryItemTypes.View)
            {
                query      = this.telemetryContext.ViewTelemetryDetails.Where(x => x.TelemetrySummary.View.ProgramId == program.Id);
                totalCount = await this.telemetryContext.ViewTelemetryDetails.CountAsync(x => x.TelemetrySummary.View.ProgramId == program.Id).ConfigureAwait(false);
            }
            else
            {
                query      = this.telemetryContext.EventTelemetryDetails.Where(x => x.TelemetrySummary.Event.ProgramId == program.Id && !string.IsNullOrEmpty(x.TelemetrySummary.Event.Name)); //todo remove this empty string check after dealing with heartbeat data
                totalCount = await this.telemetryContext.EventTelemetryDetails.CountAsync(x => x.TelemetrySummary.Event.ProgramId == program.Id && !string.IsNullOrEmpty(x.TelemetrySummary.Event.Name)).ConfigureAwait(false);
            }



            IQueryable <TelemetryDetail> filteredQuery = EntityFilter.Match(query
                                                                            , property => property.Contains(requestSearch.Value)
                                                                            , new List <Expression <Func <TelemetryDetail, string> > >()
            {
                { x => x.Sequence },
                { x => x.IpAddress },
                { x => x.UserIdentifier },
                { x => x.EntryKey },
            });


            if (take == -1)
            {
                take = totalCount;
            }

            List <TelemetryDetail> usages = await ApplyOrderingQuery(sortBy, filteredQuery, skip, take).ConfigureAwait(false);

            List <DataTableTelemetryData> result = new List <DataTableTelemetryData>();

            foreach (TelemetryDetail detail in usages)
            {
                DataTableTelemetryData data = new DataTableTelemetryData()
                {
                    Timestamp        = detail.Timestamp
                    , UserName       = detail.UserIdentifier
                    , IpAddress      = detail.IpAddress
                    , EntryKey       = detail.EntryKey
                    , ProgramVersion = detail.FileVersion
                    , Sequence       = detail.Sequence
                    , Properties     = detail.GetTelemetryUnits().Where(x => x.UnitType == TelemetryUnit.UnitTypes.Property).ToDictionary(x => x.Key, x => x.ValueString)
                    , Metrics        = detail.GetTelemetryUnits().Where(x => x.UnitType == TelemetryUnit.UnitTypes.Metric).ToDictionary(x => x.Key, x => x.ValueDouble)
                };
                result.Add(data);
            }

            return(new UsageDataTableResult {
                TotalCount = totalCount, FilteredCount = totalCount, UsageData = result
            });
        }
 public HomeControllerTest()
 {
     _searchService = DependencyResolver.Current.GetService <ISearch>();
 }
Exemplo n.º 24
0
 public MyAccountPage()
 {
     Search = Application.Get(ApplicationSourceRepository.Default()).Search;
 }
Exemplo n.º 25
0
 public SearchController(ISearch requestService)
 {
     _requestService = requestService;
 }
Exemplo n.º 26
0
 public UnitTest1()
 {
     Search = new NormalSearch();
 }
 public HyperspinDataProvider()
 {
     _searchGameXml = new XmlSearch <Game>();
 }
Exemplo n.º 28
0
 public SearchController(ISearch context)
 {
     _context = context;
 }
Exemplo n.º 29
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:EPiServer.Commerce.FindSearchProvider.FindSearchQueryBuilder" /> class.
        /// </summary>
        /// <param name="client">The client.</param>
        /// <param name="criteria">The criteria.</param>
        /// <param name="languageOption">The language option.</param>
        /// <exception cref="T:System.InvalidOperationException">The Find search query builder only works with clients created by the provider.</exception>
        public FindSearchQueryBuilder(IClient client, ISearchCriteria criteria, QueryCultureOption languageOption)
        {
            ProviderClient providerClient = client as ProviderClient;

            if (providerClient == null)
            {
                throw new InvalidOperationException("The Find search query builder only works with clients created by the provider.");
            }
            ISearchConfiguration       providerConfiguration = providerClient.ProviderConfiguration;
            Language                   language  = (Language)null;
            ITypeSearch <FindDocument> search1   = criteria.IgnoreFilterOnLanguage || !FindSearchQueryBuilder._providerLanguages.TryGetValue(criteria.Locale, out language) ? providerClient.Search <FindDocument>() : providerClient.Search <FindDocument>(language);
            CatalogEntrySearchCriteria criteria1 = criteria as CatalogEntrySearchCriteria;

            if (criteria1 != null)
            {
                ITypeSearch <FindDocument> search2;
                if (criteria.IgnoreFilterOnLanguage)
                {
                    search2 = search1.ForDefaultFields(criteria1.SearchPhrase, string.Empty);
                }
                else
                {
                    ITypeSearch <FindDocument> search3 = search1.ForDefaultFields(criteria1.SearchPhrase, criteria.Locale);
                    HashSet <string>           source  = new HashSet <string>((IEqualityComparer <string>)StringComparer.OrdinalIgnoreCase);
                    if (language != null && !string.IsNullOrEmpty(language.FieldSuffix) && languageOption.HasFlag((Enum)QueryCultureOption.Neutral))
                    {
                        source.Add(language.FieldSuffix);
                    }
                    if (!string.IsNullOrEmpty(criteria.Locale) && languageOption.HasFlag((Enum)QueryCultureOption.Specific))
                    {
                        source.Add(criteria.Locale);
                    }
                    if (!source.Any <string>())
                    {
                        source.Add(ContentLanguage.PreferredCulture.Name);
                    }
                    search2 = search3.FilterLanguages((IEnumerable <string>)source);
                }
                if (DateTime.MinValue < criteria1.StartDate && criteria1.EndDate < DateTime.MaxValue)
                {
                    search2 = search2.FilterDates(criteria1.StartDate, criteria1.EndDate, criteria1.IncludePreorderEntry);
                }
                search1 = search2.FilterCatalogs(this.ToStringEnumerable(criteria1.CatalogNames)).FilterCatalogNodes(this.GetNodes(criteria1)).FilterOutlines(this.GetOutlines(criteria1)).FilterMetaClasses(this.ToStringEnumerable(criteria1.SearchIndex)).FilterCatalogEntryTypes(this.ToStringEnumerable(criteria1.ClassTypes));
                if (!criteria1.IncludeInactive)
                {
                    search1 = search1.FilterInactiveCatalogEntries();
                }
                if (criteria1.MarketId != MarketId.Empty)
                {
                    search1 = search1.FilterCatalogEntryMarket(criteria1.MarketId);
                }
            }
            ITypeSearch <FindDocument> search4 = search1.AddActiveFilters(criteria).AddFacets(criteria).OrderBy(criteria);

            if (criteria.StartingRecord > 0)
            {
                search4 = search4.Skip <FindDocument>(criteria.StartingRecord);
            }
            if (criteria.RecordsToRetrieve > 0)
            {
                search4 = search4.Take <FindDocument>(criteria.RecordsToRetrieve);
            }
            this.Search = (ISearch <FindDocument>)search4;
        }
Exemplo n.º 30
0
 public SearchUser(ISearch model) : base(model)
 {
 }
 public ProductListModel(ISearch search) : base(search)
 {
 }
Exemplo n.º 32
0
 public BatchReceiptDetailsQueryHandler(ISearch <ReceiptBatch> batches)
 {
     this.batches = batches;
 }
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="TModel"></typeparam>
        /// <param name="column"></param>
        /// <param name="search"></param>
        /// <param name="parameterExpression"></param>
        /// <returns></returns>
        /// <exception cref="NotSupportedException">Thrown when the searchquery is based on an regular expression</exception>
        public override Expression <Func <TModel, bool> > GetExpression <TModel>(IColumn column, ISearch search, ParameterExpression parameterExpression)
        {
            var sourcePropertyName = column.Field ?? column.Name;
            var sourceProperty     = GetProperty <TModel> .ByName(sourcePropertyName);

            var logicalMethod = TargetType.GetMethod(nameof(string.Contains), new[] { typeof(string), typeof(StringComparison) });
            var expression    = Expression.Call(Expression.Property(parameterExpression, sourceProperty), logicalMethod, Expression.Constant(search.Value), Expression.Constant(StringComparison.CurrentCultureIgnoreCase));

            return(Expression.Lambda <Func <TModel, bool> >(expression, new ParameterExpression[] { parameterExpression }));
        }
Exemplo n.º 34
0
 protected override IQueryable <Course> SearchAllColumns(IQueryable <Course> queryable, ISearch search)
 {
     return(queryable.Where(x =>
                            x.Name.Contains(search.Value) ||
                            x.Description.Contains(search.Value)));
 }
Exemplo n.º 35
0
 public PageService(IPageRepository repo, IContentFactory factory, ISiteService siteService, IParamService paramService, IMediaService mediaService, ICache cache = null, ISearch search = null)
 {
     base();
     this._repo         = repo;
     this._factory      = factory;
     this._siteService  = siteService;
     this._paramService = paramService;
     this._mediaService = mediaService;
     this._search       = search;
     if (App.get_CacheLevel() > 2)
     {
         this._cache = cache;
     }
     return;
 }
Exemplo n.º 36
0
 public SearchService(ISearch dBSearch)
 {
     DBSearch = dBSearch;
 }
Exemplo n.º 37
0
 public MyAccountPage()
 {
     Search = Application.Get().Search;
 }
Exemplo n.º 38
0
 public SearchAndReturnPipe(WebResourceManager parent,
     ISearch engine, InputQuery query, Pipeline pipeline)
 {
     // Assert(engine!= null && query != null)
     _parent = parent;
     _searchEngine = engine;
     _inputQuery = query;
     _thread = new Thread(new ThreadStart(SearchAndReturn));
     _thread.IsBackground = true;
     _thread.Start();
 }
Exemplo n.º 39
0
        private void LoadSearchData(ISearch search)
        {
            using (search)
            {
                TotalAlbums = search.TotalAlbums;
                TotalTracks = search.TotalTracks;
                TotalArtists = search.TotalArtists;
                Query = search.Query;
                DidYouMean = search.DidYouMean;

                foreach (var spotifyAlbum in search.Albums)
                {
                    _albums.Add(new Album(spotifyAlbum, _dispatcher));
                }

                foreach (var spotifyTrack in search.Tracks)
                {
                    _tracks.Add(new Track(spotifyTrack, _dispatcher));
                }

                foreach (var spotifyArtist in search.Artists)
                {
                    _artists.Add(new Artist(spotifyArtist, _dispatcher));
                }
            }
            search.Completed -= OnSearchCompleted;
            IsLoading = false;
            RaiseFinishedLoading();
        }
 public ExpenseCategoryEditorFormQueryHandler(ISearch <ExpenseCategory> categories)
 {
     this.categories = categories;
 }
Exemplo n.º 41
0
        public async Task <UsageDataTableResult> GetExceptions(Guid telemetryKey, TelemetryItemTypes itemType, int skip
                                                               , int take, IEnumerable <Tuple <string, bool> > sortBy, ISearch requestSearch
                                                               , List <string> searchableColumns)
        {
            Program program = await this.portalContext.Programs.FirstOrDefaultAsync(x => x.TelemetryKey == telemetryKey).ConfigureAwait(false);

            if (program == null)
            {
                throw new ArgumentException($"Program with key {telemetryKey} does not exist");
            }

            IQueryable <ExceptionInfo> query = this.telemetryContext.Exceptions.Where(x => x.ProgramId == program.Id);
            int totalCount = await this.telemetryContext.Exceptions.CountAsync(x => x.ProgramId == program.Id).ConfigureAwait(false);

            if (take == -1)
            {
                take = totalCount;
            }



            IQueryable <ExceptionInfo> filteredQuery = EntityFilter.Match(query
                                                                          , property => property.Contains(requestSearch.Value)
                                                                          , new List <Expression <Func <ExceptionInfo, string> > >()
            {
                { x => x.Sequence },
                { x => x.Message },
                { x => x.TypeName },
                { x => x.ProgramVersion },
                { x => x.ParsedStack },
                { x => x.UserName },
            });


            List <ExceptionInfo> ordered = await ApplyOrderingQuery(sortBy, filteredQuery, skip, take).ConfigureAwait(false);

            List <ExceptionData> result = new List <ExceptionData>();

            foreach (ExceptionInfo exception in ordered)
            {
                ExceptionData data = new ExceptionData
                {
                    Timestamp        = exception.Timestamp
                    , UserName       = exception.UserName
                    , EntryKey       = exception.TypeName
                    , Note           = exception.Note
                    , ProgramVersion = exception.ProgramVersion
                    , Sequence       = exception.Sequence
                    , ErrorMessage   = exception.Message
                    , StackTrace     = GetStackTrace(exception.ParsedStack)
                    , Properties     = exception.TelemetryUnits.Where(x => x.UnitType == TelemetryUnit.UnitTypes.Property).ToDictionary(x => x.Key, x => x.ValueString)
                    , Metrics        = exception.TelemetryUnits.Where(x => x.UnitType == TelemetryUnit.UnitTypes.Metric).ToDictionary(x => x.Key, x => x.ValueDouble)
                };
                result.Add(data);
            }

            return(new UsageDataTableResult {
                TotalCount = totalCount, FilteredCount = totalCount, UsageData = result
            });
        }
Exemplo n.º 42
0
 public FundsWidgetPostProcessor(ISearch <Fund> funds)
 {
     this.funds = funds;
 }
Exemplo n.º 43
0
 public bool Commit()
 {
     if (!Util.NOCOMMIT)
     {
         if (this.PStorage.Commit(this.SongList))
         {
             this.toBeCommited = false;
             Util.NRSONGS = this.SongList.Count;
             this.search = new IndexSearch(this.SongList.Values, true); // lucene searcher! (re-index!)
             return true;
         }
         else
         {
             return false;
         }
     }
     else
     {
         Util.MBoxError("Sie haben keine Berechtigung, Änderungen vorzunehmen!\n" +
                        "Entfernen Sie unter Extras->Optionen..., Allgemein... den Schreibschutz\n" +
                        "oder wenden Sie sich an den Administrator.");
         return false;
     }
 }
Exemplo n.º 44
0
 public static void ProgressesAsExpected(
     LinqGraph graph,
     ISearch <LinqGraph.Node, LinqGraph.Edge> search,
     int expectedTargetId,
     (int from, int to)[] expectedSteps)
Exemplo n.º 45
0
 public void RemoveSearch(ISearch search)
 {
     _searches.Remove(search);
 }
Exemplo n.º 46
0
        private void ProcessMessage(CompletionTracker completion, IZPushItem item)
        {
            if (!_feature.ProcessMessage)
            {
                return;
            }

            // Check if the message is for the current sequence
            ChunkIndex?optionalIndex = ChunkIndex.Parse(item.Subject);

            if (optionalIndex == null)
            {
                Logger.Instance.Trace(this, "Not a chunk: {0}", item.Subject);
                return;
            }

            if (optionalIndex.Value.numberOfChunks != CurrentSequence)
            {
                // Try to update the current sequence; this message may indicate that it has changed
                DetermineSequence();

                // If it is still not for the current sequence, it's an old message
                if (optionalIndex.Value.numberOfChunks != CurrentSequence)
                {
                    Logger.Instance.Trace(this, "Skipping, wrong sequence: {0}", item.Subject);
                    return;
                }
            }
            ChunkIndex index = optionalIndex.Value;

            // Check if the message is up to date
            string lastProcessed = GetChunkStateString(index);

            if (lastProcessed == item.Location)
            {
                Logger.Instance.Trace(this, "Already up to date: {0} - {1}", item.Subject, item.Location);
                return;
            }

            // Process it
            Logger.Instance.Trace(this, "Processing: {0} - {1} - {2}", item.Subject, item.Location, lastProcessed);
            _feature?.BeginProcessing();
            try
            {
                if (_feature.ProcessMessageDeleteExisting)
                {
                    // Delete the old contacts from this chunk
                    using (ISearch <IItem> search = Contacts.Search <IItem>())
                    {
                        search.AddField(PROP_SEQUENCE, true).SetOperation(SearchOperation.Equal, index.numberOfChunks);
                        search.AddField(PROP_CHUNK, true).SetOperation(SearchOperation.Equal, index.chunk);
                        foreach (IItem oldItem in search.Search())
                        {
                            Logger.Instance.Trace(this, "Deleting GAB entry: {0}", oldItem.Subject);
                            oldItem.Delete();
                        }
                    }
                }

                // Create the new contacts
                ProcessChunkBody(completion, item, index);

                // Update the state
                SetChunkStateString(index, item.Location);
            }
            finally
            {
                _feature?.EndProcessing();
            }
        }
Exemplo n.º 47
0
        void UpdateSearch(ISearch target)
        {
            using (var ctx = new SearcherEntities())
            {
                var original = ctx.Searches.Single(x => x.Id == target.Id);
                var targetTerms = target.SearchTerms.Select(x => x.Term.ToLower());
                var sourceTerms = original.SearchTerms.Select(x => x.Term.ToLower());
                //handle deletes
                original.SearchTerms.Where(x => !targetTerms.Contains(x.Term.ToLower()))
                    .ToList()
                    .ForEach(x =>
                    {
                        ctx.SearchTerms.Remove(x);
                    });

                //handle updates to existing
                original.SearchTerms.ToList().ForEach(x =>
                {
                    var updated = target.SearchTerms.Single(n => n.Term.ToLower() == x.Term.ToLower());
                    if (updated.Score != x.Score)
                    {
                        x.Score = updated.Score;
                        x.UpdatedOnUtc = System.DateTime.UtcNow;
                    }
                });
                //handle inserts
                target.SearchTerms.Where(x => !sourceTerms.Contains(x.Term.ToLower())).ToList().ForEach(x =>
                {
                    var newTerm = new SearchTerm
                    {
                        Id = Guid.NewGuid(),
                        CreatedOnUtc = System.DateTime.UtcNow,
                        Score = x.Score,
                        Term = x.Term
                    };
                    original.SearchTerms.Add(newTerm);
                });
                ctx.SaveChanges();
            }
        }
Exemplo n.º 48
0
 public WindowsSearchAPI(ISearch windowsIndexerSearch, bool displayHiddenFiles = false)
 {
     this.WindowsIndexerSearch = windowsIndexerSearch;
     this.DisplayHiddenFiles   = displayHiddenFiles;
 }
Exemplo n.º 49
0
 /// <summary>
 /// Initialize a new instance of the SearchViewModel class.
 /// </summary>
 /// <param name="Source">The source.</param>
 public SearchViewModel(ISearch Source)
 {
     // Set the source.
     this.Source = Source;
 }
Exemplo n.º 50
0
        public Results Get(string algorithm, long size, int blockSize, int parallelism, string id)
        {
            var bufferSize = blockSize * 1000000;
            var totalSize  = size * 1000000;
            var partitions = (totalSize / bufferSize);
            var pattern    = Encoding.ASCII.GetBytes(id.ToString());
            var timer      = new Stopwatch();
            var results    = new Results()
            {
                Pattern = id.ToString()
            };
            var parts        = new List <long>();
            var patternFound = false;

            for (long i = 0; i < partitions; i++)
            {
                parts.Add(Convert.ToInt64(i * bufferSize));
            }

            timer.Start();

            Parallel.ForEach(parts, new ParallelOptions {
                MaxDegreeOfParallelism = parallelism
            }, (x) =>
            {
                using (var stream = new FileStream(HostingEnvironment.MapPath($@"~/App_Data/pi-billion.txt"), FileMode.Open, FileAccess.Read))
                {
                    var result = new Result {
                        TaskId = Task.CurrentId, FromByte = x, ToByte = x + bufferSize
                    };

                    if (!patternFound)
                    {
                        stream.Seek(x, SeekOrigin.Begin);
                        var buffer    = new byte[bufferSize];
                        var bytesRead = stream.Read(buffer, 0, bufferSize);

                        if (bytesRead > 0)
                        {
                            ISearch searcher = SearchFactory.Get(algorithm);
                            searcher.SetPattern(pattern);
                            var position = searcher.Search(buffer);

                            if (position > -1)
                            {
                                patternFound    = true;
                                result.Position = x + position;
                                var digits      = buffer.Skip((position - MyConfig.DigitCount).Min0()).Take(pattern.Length + MyConfig.DigitCount * 2).ToList();
                                result.Digits   = Encoding.ASCII.GetString(digits.ToArray());
                            }
                        }

                        result.ExecutionTime = timer.Elapsed.TotalSeconds;

                        lock (results)
                        {
                            results.Length += bytesRead;
                            results.Tasks.Add(result);
                        }
                    }
                }
            });

            timer.Stop();
            results.ExecutionTime = Math.Round(timer.Elapsed.TotalSeconds, 3);
            return(results);
        }
 public SearchWindow(ISearch search)
 {
     InitializeComponent();
     this.DataContext = new SearchViewModel(search, new NavigationService(this));
 }
Exemplo n.º 52
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="repo">The page repository</param>
        /// <param name="factory">The content factory</param>
        /// <param name="langService">The language service</param>
        /// <param name="cache">The optional cache service</param>
        /// <param name="search">The optional search service</param>
        public ContentService(IContentRepository repo, IContentFactory factory, ILanguageService langService, ICache cache = null, ISearch search = null)
        {
            _repo        = repo;
            _factory     = factory;
            _langService = langService;

            if ((int)App.CacheLevel > 2)
            {
                _cache = cache;
            }
            _search = search;
        }
Exemplo n.º 53
0
 internal SearchEventArgs(ISearch result)
 {
     this.result = result;
 }
Exemplo n.º 54
0
 public ForgotPasswordPage( )
 {
     Search = Application.Get().Search;
 }
Exemplo n.º 55
0
 private static KeyValuePair<string, List<SearchResult>> ProcessSearchableType(ISearch instance, string term)
 {
     try
     {
         return new KeyValuePair<string, List<SearchResult>>(instance.SearchResultMoniker, instance.SimpleQuery(term));
     }
     catch (Exception e)
     {
         Current.Log.Add(e);
         return new KeyValuePair<string, List<SearchResult>>(instance.SearchResultMoniker, new List<SearchResult>());
     }
 }
Exemplo n.º 56
0
 public AccountEditorFormQueryHandler(ISearch <Account> accounts, ISearch <Fund> funds)
 {
     this.accounts = accounts;
     this.funds    = funds;
 }
Exemplo n.º 57
0
 public bool RemoveSearchEngine(ISearch searchEngine)
 {
     return _searchEngineList.Remove(searchEngine);
 }
Exemplo n.º 58
0
 public ToggleReceiptSourceIsActiveCommandHandler(ISearch <ReceiptSource> sources, IUnitOfWork unitOfWork)
 {
     this.sources    = sources;
     this.unitOfWork = unitOfWork;
 }
Exemplo n.º 59
0
 public bool AddSearchEngine(ISearch searchEngine)
 {
     if (searchEngine == null)
     {
         return false;
     }
     _searchEngineList.Add(searchEngine);
     return true;
 }
Exemplo n.º 60
0
 public Jisho(DiscordBot jisho, ISearch search)
 {
     _jisho  = jisho;
     _search = search;
 }