示例#1
0
        private void CloseExpiredJobAds()
        {
            const string method = "CloseExpiredJobAds";

            EventSource.Raise(Event.Information, method, "Closing expired job ads");

            var ids   = _jobAdsQuery.GetExpiredJobAdIds();
            var count = 0;

            foreach (var id in ids)
            {
                try
                {
                    var jobAd = _jobAdsQuery.GetJobAd <JobAd>(id);
                    if (jobAd != null)
                    {
                        _jobAdsCommand.CloseJobAd(jobAd);
                        ++count;
                    }
                }
                catch (Exception ex)
                {
                    EventSource.Raise(Event.Error, method, string.Format("Could not close the '{0}' job ad.", id), ex);
                }
            }

            EventSource.Raise(Event.Information, method, string.Format("{0} expired job ads were closed.", count));
        }
示例#2
0
        private void WriteJobAd(string directory)
        {
            var job      = _jobAdsQuery.GetJobAd <JobAd>(_currentId);
            var path     = Path.Combine(TrainingDataDirectory, directory);
            var filename = Path.Combine(path, job.Id + ".txt");

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            using (var file = new StreamWriter(filename))
            {
                file.WriteLine(job.Title);

                if (job.Description.Salary != null && !job.Description.Salary.IsEmpty)
                {
                    file.WriteLine("Salary: {0:C} to {1:C}", job.Description.Salary.LowerBound, job.Description.Salary.UpperBound);
                }

                if (job.Description.BulletPoints != null)
                {
                    foreach (var bulletPoint in job.Description.BulletPoints)
                    {
                        file.WriteLine(bulletPoint);
                    }
                }
                file.WriteLine(job.Description.Content);
            }
        }
示例#3
0
        public ActionResult RedirectToExternal(Guid jobAdId, Guid?applicationId)
        {
            var jobAd = _jobAdsQuery.GetJobAd <JobAd>(jobAdId);

            if (jobAd == null || string.IsNullOrEmpty(jobAd.Integration.ExternalApplyUrl))
            {
                return(NotFound("job ad", "id", jobAdId));
            }

            if (applicationId == null)
            {
                // Try to get the current user's application for this job ad.

                var user = CurrentUser;
                if (user != null)
                {
                    var application = _memberApplicationsQuery.GetInternalApplication(user.Id, jobAdId);
                    if (application != null)
                    {
                        applicationId = application.Id;
                    }
                }
            }

            HttpContext.Response.AppendHeader("Referrer", jobAd.GenerateJobAdUrl().AbsoluteUri);
            return(RedirectToUrl(jobAd.GetExternalApplyUrl(applicationId)));
        }
示例#4
0
        void ISendApplicationsCommand.SendApplication(InternalApplication application, IEnumerable <ApplicationAnswer> answers)
        {
            var jobAd = _jobAdsQuery.GetJobAd <JobAdEntry>(application.PositionId);

            // Look for a member first.

            var member = _membersQuery.GetMember(application.ApplicantId);

            if (member != null)
            {
                // Send.

                if (application.ResumeFileId != null)
                {
                    SendResumeFile(application, member, jobAd, answers);
                }
                else
                {
                    SendResume(application, member, jobAd, answers);
                }
            }
            else
            {
                var user = _anonymousUsersQuery.GetContact(application.ApplicantId);
                if (user != null && application.ResumeFileId != null)
                {
                    SendResumeFile(application, user, jobAd, answers);
                }
            }
        }
示例#5
0
        public ActionResult SuggestedCandidates(Guid jobAdId, CandidatesPresentationModel presentation)
        {
            // Anyone can see any job ad.

            var jobAd = _jobAdsQuery.GetJobAd <JobAd>(jobAdId);

            if (jobAd == null)
            {
                return(NotFound("job ad", "id", jobAdId));
            }

            // Get the criteria for the search.

            var criteria        = _suggestedMembersQuery.GetCriteria(jobAd);
            var criteriaIsEmpty = criteria.IsEmpty;

            criteria.PrepareCriteria();
            if (criteriaIsEmpty)
            {
                SetDefaults(criteria);
            }

            // Search.

            var model = Search(CurrentEmployer, jobAdId, criteria, presentation, jobAd.Title, jobAd.Status);

            // Save the basis for the search.

            EmployerContext.CurrentCandidates = new SuggestedCandidatesNavigation(jobAdId, jobAd.Title, jobAd.Status, criteria, presentation);
            return(View(model));
        }
示例#6
0
        T IEmployerJobAdsQuery.GetJobAd <T>(IEmployer employer, Guid jobAdId)
        {
            var jobAd = _jobAdsQuery.GetJobAd <T>(jobAdId);

            if (jobAd == null)
            {
                return(null);
            }

            return(CanAccess(employer, jobAd) ? jobAd : null);
        }
示例#7
0
        public ActionResult EmailJobAds(EmailJobAdsModel emailJobAdsModel)
        {
            try
            {
                // If there is a current member then it needs to come from them.

                var member = CurrentMember;
                if (member != null)
                {
                    emailJobAdsModel.FromName         = member.FullName;
                    emailJobAdsModel.FromEmailAddress = member.GetBestEmailAddress().Address;
                }

                emailJobAdsModel.Prepare();
                emailJobAdsModel.Validate();

                foreach (var jobAdId in emailJobAdsModel.JobAdIds)
                {
                    var jobAd = _jobAdsQuery.GetJobAd <JobAdEntry>(jobAdId);
                    if (jobAd == null)
                    {
                        return(JsonNotFound("job ad"));
                    }

                    // Send to each recipient.

                    foreach (var to in emailJobAdsModel.Tos)
                    {
                        var email = new SendJobToFriendEmail(to.ToEmailAddress, to.ToName,
                                                             emailJobAdsModel.FromEmailAddress, emailJobAdsModel.FromName, jobAd, null);
                        _emailsCommand.TrySend(email);
                    }
                }
            }
            catch (UserException ex)
            {
                ModelState.AddModelError(ex, new JobAdsErrorHandler());
            }

            return(Json(new JsonResponseModel()));
        }
示例#8
0
        public ActionResult ShortlistCandidates(Guid jobAdId, Guid[] candidateIds)
        {
            try
            {
                // Look for the jobAd.

                var employer = CurrentEmployer;

                var jobAd = _jobAdsQuery.GetJobAd <JobAdEntry>(jobAdId);
                if (jobAd == null)
                {
                    return(JsonNotFound("job ad"));
                }

                // Add candidates.

                var statuses = _jobAdApplicantsCommand.ShortlistApplicants(employer, jobAd, candidateIds);

                return(BuildModelFromStatus(jobAd, statuses));
            }
            catch (UserException ex)
            {
                ModelState.AddModelError(ex, new StandardErrorHandler());
            }

            return(Json(new JsonResponseModel()));
        }
示例#9
0
        private JobAd GetJobAd(Guid userId, Guid jobAdId)
        {
            var jobAd = _jobAdsQuery.GetJobAd <JobAd>(jobAdId);

            if (jobAd == null)
            {
                return(null);
            }

            // Ensure that the user is the poster.

            return(jobAd.PosterId == userId ? jobAd : null);
        }
示例#10
0
        protected void AdsRepeater_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            var jobAdId = new Guid((string)e.CommandArgument);
            var jobAd   = _jobAdsQuery.GetJobAd <JobAd>(jobAdId);

            if (jobAd == null)
            {
                throw new ArgumentException("No job ad with ID " + jobAdId + " was found.");
            }

            string message;

            switch (e.CommandName)
            {
            case OpenAdCommand:
                if (_jobAdsCommand.CanBeOpened(jobAd))
                {
                    message = JobAdFacade.ReopenJobAd(LoggedInEmployer, jobAd);
                    OnJobAdRemoved(e.Item.ItemIndex, message);
                }
                else
                {
                    // Reposting - simply redirect to the Purchase Preview page and take the reposting workflow from there.

                    message = "Please review the ad before publishing it.";
                    var quantity = _employerCreditsQuery.GetEffectiveActiveAllocation <JobAdCredit>(LoggedInEmployer).RemainingQuantity;
                    if (quantity != null && quantity > 0)
                    {
                        message = "Reposting this ad will use one credit. " + message;
                    }

                    var previewUrl = JobAdsRoutes.Preview.GenerateUrl(new { jobAdId = jobAd.Id });
                    RedirectWithNotification(previewUrl, NotificationType.Information, message);
                }
                break;

            case CloseAdCommand:
                message = CloseJobAd(jobAd);
                OnJobAdRemoved(e.Item.ItemIndex, message);
                break;

            case DeleteDraftCommand:
                message = DeleteDraftAd(jobAd);
                OnJobAdRemoved(e.Item.ItemIndex, message);
                break;

            default:
                throw new ApplicationException("Unexpected command");
            }
        }
示例#11
0
        private ManageCandidatesListModel JobAdResults(Guid jobAdId, ApplicantStatus?status, MemberSearchSortCriteria sortCriteria, CandidatesPresentationModel presentation)
        {
            var employer = CurrentEmployer;
            var jobAd    = _jobAdsQuery.GetJobAd <JobAd>(jobAdId);

            if (jobAd == null)
            {
                return(null);
            }

            var searchStatus = status ?? DefaultStatus;
            var model        = Search(employer, jobAdId, searchStatus, sortCriteria, presentation);

            if (model.Results.TotalCandidates == 0 && status == null)
            {
                searchStatus = FallbackStatus;
                model        = Search(employer, jobAdId, searchStatus, sortCriteria, presentation);
            }

            // Indicate those who are rejected.

            model.ApplicantStatus = searchStatus;
            model.Results.RejectedCandidateIds = searchStatus == ApplicantStatus.Rejected ? model.Results.CandidateIds : new List <Guid>();

            var applicantList = _jobAdApplicantsQuery.GetApplicantList(employer, jobAd);
            var counts        = _jobAdApplicantsQuery.GetApplicantCounts(employer, applicantList);

            model.JobAd = new JobAdDataModel
            {
                Id              = jobAdId,
                Title           = jobAd.Title,
                Status          = jobAd.Status,
                ApplicantCounts = new ApplicantCountsModel
                {
                    New         = counts[ApplicantStatus.New],
                    Rejected    = counts[ApplicantStatus.Rejected],
                    ShortListed = counts[ApplicantStatus.Shortlisted],
                },
                Applications = _jobAdApplicantsQuery.GetApplicationsByPositionId(jobAd.Id).ToDictionary(a => a.ApplicantId, a => a),
            };
            model.SortOrders  = new[] { MemberSortOrder.DateUpdated, MemberSortOrder.Flagged, MemberSortOrder.FirstName }.OrderBy(o => o.ToString()).ToArray();
            model.Communities = _communitiesQuery.GetCommunities().ToDictionary(c => c.Id, c => c);
            model.Verticals   = _verticalsQuery.GetVerticals().ToDictionary(v => v.Id, v => v);

            EmployerContext.CurrentSearch     = null;
            EmployerContext.CurrentCandidates = new ManageCandidatesNavigation(jobAdId, model.JobAd.Status, searchStatus, presentation);

            return(model);
        }
示例#12
0
        void IJobAdExporter.Add(Guid jobAdId)
        {
            const string method = "Add";

            try
            {
                var jobAd = _jobAdsQuery.GetJobAd <JobAd>(jobAdId);
                if (jobAd == null)
                {
                    return;
                }

                if (!IsExcluded(jobAd))
                {
                    Add(jobAd);
                }
            }
            catch (Exception e)
            {
                #region Log
                Logger.Raise(Event.Error, method, e, null, Event.Arg("jobAdId", jobAdId));
                #endregion
            }
        }
示例#13
0
        public ActionResult OldJobAdId(Guid?jobAdId)
        {
            // If there is no job ad then simply redirect.

            if (jobAdId == null)
            {
                return(RedirectToUrl(JobAdsRoutes.BrowseJobAds.GenerateUrl(), true));
            }

            var jobAd = _jobAdsQuery.GetJobAd <JobAd>(jobAdId.Value);

            return(jobAd == null
                ? NotFound("job ad", "id", jobAdId)
                : RedirectToUrl(jobAd.GenerateJobAdUrl(), true));
        }
示例#14
0
        private void AppendResults(ICollection <JobSearchAlertEmailResult> emailResults, JobAdSearchResults searchResults, int maximumResults, JobSearchHighlighter highlighter, bool haveKeywords)
        {
            foreach (var jobAdId in searchResults.JobAdIds)
            {
                // Get the job ad for the result.

                var jobAd = _jobAdsQuery.GetJobAd <JobAd>(jobAdId);
                if (jobAd != null)
                {
                    AppendResult(emailResults, jobAd, highlighter, haveKeywords);
                    if (emailResults.Count == maximumResults)
                    {
                        return;
                    }
                }
            }
        }
示例#15
0
        public void TestGetExpiredJobAds()
        {
            var employer = CreateEmployer();

            // Create an open job ad.

            var activeJobAd = _jobAdsCommand.PostTestJobAd(employer);

            // Create an open job ad that has expired.

            var expiredJobAd = employer.CreateTestJobAd();

            _jobAdsCommand.PostJobAd(expiredJobAd);
            expiredJobAd.ExpiryTime = DateTime.Now.AddDays(-1);
            _jobAdsCommand.UpdateJobAd(expiredJobAd);

            Assert.AreEqual(JobAdStatus.Open, activeJobAd.Status);
            Assert.AreEqual(JobAdStatus.Open, expiredJobAd.Status);

            // Get the expired job ads.

            var ids = _jobAdsQuery.GetExpiredJobAdIds();

            Assert.AreEqual(1, ids.Count);
            Assert.AreEqual(expiredJobAd.Id, ids[0]);

            // Close them.

            foreach (var id in ids)
            {
                var closeJobAd = _jobAdsQuery.GetJobAd <JobAdEntry>(id);
                _jobAdsCommand.CloseJobAd(closeJobAd);
            }

            // Check the status.

            var jobAd = _jobAdsCommand.GetJobAd <JobAdEntry>(activeJobAd.Id);

            Assert.AreEqual(JobAdStatus.Open, jobAd.Status);
            jobAd = _jobAdsCommand.GetJobAd <JobAdEntry>(expiredJobAd.Id);
            Assert.AreEqual(JobAdStatus.Closed, jobAd.Status);

            // Do it again.

            Assert.AreEqual(0, _jobAdsQuery.GetExpiredJobAdIds().Count);
        }
示例#16
0
        protected override JobAdSortContent GetContent(Guid jobAdId, ConcurrentDictionary <Guid, EmployerContent> cache)
        {
            var jobAd = _jobAdsQuery.GetJobAd <JobAd>(jobAdId);

            if (jobAd == null)
            {
                return(null);
            }

            var employer = cache != null?cache.GetOrAdd(jobAd.PosterId, GetEmployerContent) : GetEmployerContent(jobAd.PosterId);

            return(new JobAdSortContent
            {
                JobAd = jobAd,
                LastRefreshTime = _jobAdsQuery.GetLastRefreshTime(jobAdId),
                Employer = employer,
            });
        }
示例#17
0
        public void ParseJobAdSalaries(bool limitToOpenJobAds)
        {
            var jobAdIds = limitToOpenJobAds
                ? _jobAdsQuery.GetOpenJobAdsWithoutSalaries()
                : _jobAdsQuery.GetJobAdsWithoutSalaries();

            if (jobAdIds == null || jobAdIds.Count == 0)
            {
                return;
            }

            foreach (var id in jobAdIds)
            {
                var jobAd = _jobAdsQuery.GetJobAd <JobAd>(id);

                var parsedSalary = new Salary
                {
                    Currency = Currency.AUD,
                    Rate     = SalaryRate.Year
                };

                ParseSalaryFromText(jobAd.Description.Content, ref parsedSalary);

                if (parsedSalary == null || parsedSalary.IsEmpty)
                {
                    ParseSalaryFromText(jobAd.Title, ref parsedSalary);
                }

                if (parsedSalary == null || parsedSalary.IsEmpty)
                {
                    continue;
                }

                if (!ReasonableSalary(parsedSalary))
                {
                    continue;
                }

                jobAd.Description.ParsedSalary = parsedSalary;
                _jobAdsCommand.UpdateJobAd(jobAd);
            }
        }
示例#18
0
        public ActionResult Logo(Guid jobAdId)
        {
            var jobAd = _jobAdsQuery.GetJobAd <JobAd>(jobAdId);

            if (jobAd == null || jobAd.LogoId == null || !jobAd.Features.IsFlagSet(JobAdFeatures.Logo))
            {
                return(HttpNotFound());
            }

            var fileReference = _filesQuery.GetFileReference(jobAd.LogoId.Value);

            if (fileReference == null || fileReference.FileData.FileType != FileType.CompanyLogo)
            {
                return(HttpNotFound());
            }

            // Return the file.

            return(File(_filesQuery.OpenFile(fileReference), fileReference.MediaType));
        }
示例#19
0
        public void TestLongSummary()
        {
            var integratorUser = _integrationCommand.CreateTestIntegratorUser();
            var jobPoster      = _employerAccountsCommand.CreateTestEmployer(0, _organisationsCommand.CreateTestOrganisation(0));

            var task = CreateTask(integratorUser, jobPoster);

            task.ExecuteTask();

            // Check the job ad is created.

            var ids = _jobAdsQuery.GetJobAdIds(jobPoster.Id, JobAdStatus.Open);

            Assert.AreEqual(1, ids.Count);

            var jobAd = _jobAdsQuery.GetJobAd <JobAd>(ids[0]);

            Assert.AreEqual(300, jobAd.Description.Summary.Length);
            Assert.AreEqual("This is a very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very ve...", jobAd.Description.Summary);
        }
示例#20
0
        private JobSearchModel GetSimilarJobSearchModel(IMember member, Guid jobAdId)
        {
            var execution = _executeJobAdSearchCommand.SearchSimilar(member, jobAdId, new Range(0, 1));

            if (execution.Results.TotalMatches < 2)
            {
                return(null);
            }

            var jobAd = _jobAdsQuery.GetJobAd <JobAdEntry>(jobAdId);

            if (jobAd == null)
            {
                return(null);
            }

            return(new JobSearchModel {
                TotalMatches = execution.Results.TotalMatches, Description = jobAd.Title
            });
        }
示例#21
0
        void IJobAdsHandler.OnApplicationSubmitted(Guid applicationId)
        {
            // Gather.

            var application = _memberApplicationsQuery.GetInternalApplication(applicationId);

            if (application == null)
            {
                return;
            }

            var jobAd = _jobAdsQuery.GetJobAd <JobAd>(application.PositionId);

            if (jobAd == null)
            {
                return;
            }

            if (!ShouldSend(jobAd, application))
            {
                return;
            }

            var member = _membersQuery.GetMember(application.ApplicantId);

            if (member == null)
            {
                return;
            }

            // Send.

            if (application.ResumeFileId != null)
            {
                SendEmailWithResumeFile(application, member, jobAd);
            }
            else
            {
                SendEmailWithResume(application, member, jobAd);
            }
        }
示例#22
0
        public void TestCloseExpiredJobAds()
        {
            var employer = CreateEmployer();
            var jobAd1   = PostExpiryJobAd(employer, DateTime.Now.AddDays(-20), DateTime.Now.AddDays(-5));
            var jobAd2   = PostExpiryJobAd(employer, DateTime.Now.AddDays(-20), DateTime.Now.AddDays(2));
            var jobAd3   = PostExpiryJobAd(employer, DateTime.Now.AddDays(-20), DateTime.Now.AddDays(-1));
            var jobAd4   = PostExpiryJobAd(employer, DateTime.Now.AddDays(-20), DateTime.Now.AddDays(6));

            Assert.AreEqual(JobAdStatus.Open, _jobAdsQuery.GetJobAd <JobAd>(jobAd1.Id).Status);
            Assert.AreEqual(JobAdStatus.Open, _jobAdsQuery.GetJobAd <JobAd>(jobAd2.Id).Status);
            Assert.AreEqual(JobAdStatus.Open, _jobAdsQuery.GetJobAd <JobAd>(jobAd3.Id).Status);
            Assert.AreEqual(JobAdStatus.Open, _jobAdsQuery.GetJobAd <JobAd>(jobAd4.Id).Status);

            new UpdateJobAdsTask(_jobAdsCommand, _jobAdsQuery).ExecuteTask();

            Assert.AreEqual(JobAdStatus.Closed, _jobAdsQuery.GetJobAd <JobAd>(jobAd1.Id).Status);
            Assert.AreEqual(JobAdStatus.Open, _jobAdsQuery.GetJobAd <JobAd>(jobAd2.Id).Status);
            Assert.AreEqual(JobAdStatus.Closed, _jobAdsQuery.GetJobAd <JobAd>(jobAd3.Id).Status);
            Assert.AreEqual(JobAdStatus.Open, _jobAdsQuery.GetJobAd <JobAd>(jobAd4.Id).Status);

            new UpdateJobAdsTask(_jobAdsCommand, _jobAdsQuery).ExecuteTask();

            Assert.AreEqual(JobAdStatus.Closed, _jobAdsQuery.GetJobAd <JobAd>(jobAd1.Id).Status);
            Assert.AreEqual(JobAdStatus.Open, _jobAdsQuery.GetJobAd <JobAd>(jobAd2.Id).Status);
            Assert.AreEqual(JobAdStatus.Closed, _jobAdsQuery.GetJobAd <JobAd>(jobAd3.Id).Status);
            Assert.AreEqual(JobAdStatus.Open, _jobAdsQuery.GetJobAd <JobAd>(jobAd4.Id).Status);
        }
示例#23
0
        public void TestEmployerHasCredits()
        {
            var organisation = CreateOrganisation(0, true);
            var employer1    = CreateEmployer(1, organisation);
            var employer2    = CreateEmployer(2, organisation);

            // Allocate to parent organisation and to second employer.

            Allocate(organisation.Id, 2, null);
            Allocate(employer2.Id, 2, null);

            var jobAd1 = _jobAdsCommand.PostTestJobAd(employer1);
            var jobAd2 = _jobAdsCommand.PostTestJobAd(employer2);

            Assert.AreEqual(JobAdStatus.Open, _jobAdsQuery.GetJobAd <JobAdEntry>(jobAd1.Id).Status);
            Assert.AreEqual(JobAdStatus.Open, _jobAdsQuery.GetJobAd <JobAdEntry>(jobAd2.Id).Status);

            // Submit.

            var member = _memberAccountsCommand.CreateTestMember(0);

            Submit(member.Id, jobAd1);

            AssertAllocations(organisation.Id, 1, null);
            AssertAllocations(employer2.Id, 2, null);
            Assert.AreEqual(JobAdStatus.Open, _jobAdsQuery.GetJobAd <JobAdEntry>(jobAd1.Id).Status);
            Assert.AreEqual(JobAdStatus.Open, _jobAdsQuery.GetJobAd <JobAdEntry>(jobAd2.Id).Status);

            // Submit again.

            member = _memberAccountsCommand.CreateTestMember(1);
            Submit(member.Id, jobAd1);

            AssertAllocations(organisation.Id, 0);
            AssertAllocations(employer2.Id, 2, null);
            Assert.AreEqual(JobAdStatus.Closed, _jobAdsQuery.GetJobAd <JobAdEntry>(jobAd1.Id).Status);

            // This job ad remains open because employer2 has their own credits.

            Assert.AreEqual(JobAdStatus.Open, _jobAdsQuery.GetJobAd <JobAdEntry>(jobAd2.Id).Status);
        }
示例#24
0
        JobAdSearchResults IJobAdSearchService.SearchSimilar(Guid?memberId, Guid jobAdId, JobAdSearchQuery searchQuery)
        {
            const string method = "GetSimilarJobs";

            try
            {
                var reader   = GetReader();
                var searcher = new Searcher(reader);

                var docId = searcher.Fetch(jobAdId);

                // If the job ad cannot be found then return no results.

                if (docId == -1)
                {
                    return(new JobAdSearchResults());
                }

                var jobAd = _jobAdsQuery.GetJobAd <JobAd>(jobAdId);
                if (jobAd == null)
                {
                    return(new JobAdSearchResults());
                }

                // Look for more like this.

                var mlt = new MoreLikeThis(reader);
                mlt.setAnalyzer(_contentAnalyzer);
                mlt.setFieldNames(new [] { FieldName.Content, FieldName.Title });
                var query = mlt.like(docId);

                //query = new SeniorityIndexHandler().GetQuery(query, new JobAdSearchQuery {SeniorityIndex = jobAd.SeniorityIndex});

                // Ensure the initial job is not in the results.

                var searchFilter = new BooleanFilter();
                searchFilter.add(new FilterClause(new SpecialsFilter(SearchFieldName.Id, false, new[] { jobAdId.ToFieldValue() }), BooleanClause.Occur.MUST_NOT));

                // Add salary and location restriction.

                var filter = _indexer.GetFilter(
                    new JobAdSearchQuery
                {
                    Salary          = FudgeSalary(jobAd.Description.Salary),
                    ExcludeNoSalary = true,
                    Location        = jobAd.Description.Location,
                    Distance        = 50,
                },
                    null,
                    null);

                searchFilter.add(new FilterClause(filter, BooleanClause.Occur.MUST));

                return(searcher.Search(query, searchFilter, null, null, searchQuery.Skip, searchQuery.Take ?? reader.maxDoc(), false));
            }
            catch (Exception e)
            {
                #region Log
                EventSource.Raise(Event.Error, method, "Unexpected exception.", e);
                #endregion
                throw;
            }
        }
示例#25
0
        JobAdView IMemberJobAdViewsQuery.GetJobAdView(Guid jobAdId)
        {
            var jobAd = _jobAdsQuery.GetJobAd <JobAd>(jobAdId);

            return(jobAd == null ? null : GetJobAdView(jobAd));
        }