示例#1
0
        void IContentHandler.AddContent(Document document, JobAdSearchContent content)
        {
            Salary salary = null;

            if (content.JobAd.Description.Salary == null)
            {
                if (content.JobAd.Description.ParsedSalary != null)
                {
                    salary = content.JobAd.Description.ParsedSalary.ToRate(SalaryRate.Year);
                }
            }
            else
            {
                salary = content.JobAd.Description.Salary.ToRate(SalaryRate.Year);
            }

            var minSalary = salary == null ? null : salary.LowerBound;
            var maxSalary = salary == null ? null : salary.UpperBound;

            AddContent(document, minSalary, maxSalary, true);

            // Boost documents with a salary.

            _booster.SetSalaryBoost(document, minSalary.HasValue || maxSalary.HasValue);
        }
示例#2
0
        void IContentHandler.AddContent(Document document, JobAdSearchContent content)
        {
            var time = content.LastRefreshTime == null
                ? content.JobAd.CreatedTime
                : content.LastRefreshTime.Value < content.JobAd.CreatedTime
                    ? content.JobAd.CreatedTime
                    : content.LastRefreshTime.Value;

            AddContent(document, time);
        }
示例#3
0
        void IContentHandler.AddContent(Document document, JobAdSearchContent content)
        {
            if (content.JobAd.FeatureBoost == JobAdFeatureBoost.None)
            {
                return;
            }

            var field = new NumericField(FieldName.Featured).setIntValue(content.JobAd.FeatureBoost == JobAdFeatureBoost.Low ? 1 : 2);

            _booster.SetBoost(field);
            document.add(field);

            // Also boost the document as well.

            _booster.SetFeatureBoost(document, content.JobAd.FeatureBoost);
        }
示例#4
0
        void IContentHandler.AddContent(Document document, JobAdSearchContent content)
        {
            var communityId = content.Employer.CommunityId;
            var hasCommunityIdIndexValue = HasNoCommunityId;

            if (communityId != null)
            {
                hasCommunityIdIndexValue = HasCommunityId;
                var field = new Field(FieldName.Community, communityId.Value.ToFieldValue(), Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS);
                field.setOmitTermFreqAndPositions(true);
                _booster.SetBoost(field);
                document.add(field);
            }

            var hasCommunityField = new Field(FieldName.HasCommunity, hasCommunityIdIndexValue, Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS);

            _booster.SetBoost(hasCommunityField);
            document.add(hasCommunityField);
        }
示例#5
0
 void IContentHandler.AddContent(Document document, JobAdSearchContent content)
 {
     AddContent(document, content.JobAd.Description.Industries == null || content.JobAd.Description.Industries.Count == 0 ? null : content.JobAd.Description.Industries.Select(industry => industry.Id));
 }
示例#6
0
 void IContentHandler.AddContent(Document document, JobAdSearchContent content)
 {
     AddContent(document, content.JobAd.Description.JobTypes);
 }
示例#7
0
        public void AddContent(Document document, JobAdSearchContent content)
        {
            // Title

            if (!string.IsNullOrEmpty(content.JobAd.Title))
            {
                var field = new Field(FieldName.Title, content.JobAd.Title, Field.Store.YES, Field.Index.ANALYZED);
                _booster.SetBoost(field);
                document.add(field);

                field = new Field(FieldName.TitleExact, content.JobAd.Title, Field.Store.NO, Field.Index.ANALYZED);
                _booster.SetBoost(field);
                document.add(field);

                field = new Field(FieldName.Content, content.JobAd.Title, Field.Store.YES, Field.Index.ANALYZED);
                _booster.SetBoost(field);
                document.add(field);

                field = new Field(FieldName.ContentExact, content.JobAd.Title, Field.Store.NO, Field.Index.ANALYZED);
                _booster.SetBoost(field);
                document.add(field);
            }

            // BulletPoints

            if (content.JobAd.Description.BulletPoints != null)
            {
                foreach (var bulletPoint in content.JobAd.Description.BulletPoints)
                {
                    var field = new Field(FieldName.BulletPoints, bulletPoint, Field.Store.NO, Field.Index.ANALYZED);
                    _booster.SetBoost(field);
                    document.add(field);

                    field = new Field(FieldName.BulletPointsExact, bulletPoint, Field.Store.NO, Field.Index.ANALYZED);
                    _booster.SetBoost(field);
                    document.add(field);

                    document.add(new Field(FieldName.Content, bulletPoint, Field.Store.YES, Field.Index.ANALYZED));
                    document.add(new Field(FieldName.ContentExact, bulletPoint, Field.Store.NO, Field.Index.ANALYZED));
                }
            }

            // Content

            if (!string.IsNullOrEmpty(content.JobAd.Description.Content))
            {
                //strip HTML from the content before indexing
                var strippedContent = HtmlUtil.StripHtmlTags(content.JobAd.Description.Content);

                document.add(new Field(FieldName.Content, strippedContent, Field.Store.YES, Field.Index.ANALYZED));
                document.add(new Field(FieldName.ContentExact, strippedContent, Field.Store.NO, Field.Index.ANALYZED));
            }

            // AdvertiserName

            // Should these be subject to HideContactDetails etc?

            var companyNames = new[] { content.JobAd.Description.CompanyName, content.JobAd.ContactDetails == null ? null : content.JobAd.ContactDetails.CompanyName, content.Employer.CompanyName };

            foreach (var companyName in companyNames.Where(name => !string.IsNullOrEmpty(name)))
            {
                var field = new Field(FieldName.AdvertiserName, companyName, Field.Store.NO, Field.Index.ANALYZED);
                _booster.SetBoost(field);
                document.add(field);

                field = new Field(FieldName.AdvertiserNameExact, companyName, Field.Store.NO, Field.Index.ANALYZED);
                _booster.SetBoost(field);
                document.add(field);

                document.add(new Field(FieldName.Content, companyName, Field.Store.NO, Field.Index.ANALYZED));
                document.add(new Field(FieldName.ContentExact, companyName, Field.Store.NO, Field.Index.ANALYZED));
            }

            // ExternalReferenceId

            if (!string.IsNullOrEmpty(content.JobAd.Integration.ExternalReferenceId))
            {
                document.add(new Field(FieldName.Content, content.JobAd.Integration.ExternalReferenceId, Field.Store.NO, Field.Index.ANALYZED));
                document.add(new Field(FieldName.ContentExact, content.JobAd.Integration.ExternalReferenceId, Field.Store.NO, Field.Index.ANALYZED));
            }

            // Package

            if (!string.IsNullOrEmpty(content.JobAd.Description.Package))
            {
                document.add(new Field(FieldName.Content, content.JobAd.Description.Package, Field.Store.YES, Field.Index.ANALYZED));
                document.add(new Field(FieldName.ContentExact, content.JobAd.Description.Package, Field.Store.NO, Field.Index.ANALYZED));
            }
        }
示例#8
0
 void IContentHandler.AddContent(Document document, JobAdSearchContent content)
 {
     AddContent(document, content.JobAd.Description.Location, null);
 }