Exemplo n.º 1
0
        private static JobType MapJobType(JobTypes jobTypes)
        {
            if (jobTypes.IsFlagSet(JobTypes.FullTime))
            {
                return new JobType {
                           id = 4, name = "Full time"
                }
            }
            ;

            if (jobTypes.IsFlagSet(JobTypes.PartTime))
            {
                return new JobType {
                           id = 1, name = "Part time"
                }
            }
            ;

            if (jobTypes.IsFlagSet(JobTypes.Contract))
            {
                return new JobType {
                           id = 2, name = "Contract"
                }
            }
            ;

            return(new JobType {
                id = 4, name = "Full time"
            });
        }
    }
}
Exemplo n.º 2
0
        public static void Map(this JobTypes jobType, out string workType, out string durationType)
        {
            workType = "F"; // Full time, Part time, Casual

            if (jobType.IsFlagSet(JobTypes.PartTime))
            {
                workType = "P";
            }

            durationType = "P"; // Permanent, Temporary, coNtract

            if (jobType.IsFlagSet(JobTypes.Contract))
            {
                durationType = "N";
            }
            else if (jobType.IsFlagSet(JobTypes.Temp))
            {
                durationType = "T";
            }
        }
Exemplo n.º 3
0
        protected void AddContent(Document document, JobTypes jobTypes)
        {
            // Add each value for search/filter purposes
            foreach (var jobType in Split(jobTypes))
            {
                var value = Encode(jobType);
                var field = new Field(_fieldName, value, Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS);
                field.setOmitTermFreqAndPositions(true);
                _booster.SetBoost(field);
                document.add(field);
            }

            if (_supportSorting)
            {
                //Now add the "highest" one for sort purposes

                var sortValue = 0;

                if (jobTypes == JobTypes.None)
                {
                    //special case for none - put them at the bottom
                    sortValue = int.MaxValue;
                }
                else if (jobTypes != JobTypes.All)
                {
                    //special case of all job types; default to whatever's first in the list (i.e. 0)
                    sortValue = DefinedJobTypesOrder.Select((jobType, index) => new { JobType = jobType, Index = index }).Where(j => jobTypes.IsFlagSet(j.JobType)).Min(j => j.Index);
                }

                document.add(new NumericField(_sortFieldName).setIntValue(sortValue));
            }
        }