@@ -430,7 +430,7 @@ async function searchJobs (currentUser, criteria, options = { returnAll: false }
430430
431431 const page = criteria . page > 0 ? criteria . page : 1
432432 let perPage
433- if ( options . returnAll ) {
433+ if ( options . returnAll || criteria . specialJob ) {
434434 // To simplify the logic we are use a very large number for perPage
435435 // because in practice there could hardly be so many records to be returned.(also consider we are using filters in the meantime)
436436 // the number is limited by `index.max_result_window`, its default value is 10000, see
@@ -480,7 +480,8 @@ async function searchJobs (currentUser, criteria, options = { returnAll: false }
480480 'status' ,
481481 'minSalary' ,
482482 'maxSalary' ,
483- 'jobLocation'
483+ 'jobLocation' ,
484+ 'specialJob'
484485 ] ) , ( value , key ) => {
485486 let must
486487 if ( key === 'description' || key === 'title' ) {
@@ -512,6 +513,27 @@ async function searchJobs (currentUser, criteria, options = { returnAll: false }
512513 }
513514 }
514515 }
516+ } else if ( key === 'specialJob' ) {
517+ if ( value === true ) {
518+ must = {
519+ bool : {
520+ should : [
521+ {
522+ term : {
523+ featured : value
524+ }
525+ } ,
526+ {
527+ term : {
528+ showInHotList : value
529+ }
530+ }
531+ ]
532+ }
533+ }
534+ } else {
535+ return true
536+ }
515537 } else {
516538 must = {
517539 term : {
@@ -689,7 +711,8 @@ searchJobs.schema = Joi.object().keys({
689711 bodySkills : Joi . array ( ) . items ( Joi . string ( ) . uuid ( ) ) ,
690712 minSalary : Joi . number ( ) . integer ( ) ,
691713 maxSalary : Joi . number ( ) . integer ( ) ,
692- jobLocation : Joi . string ( )
714+ jobLocation : Joi . string ( ) ,
715+ specialJob : Joi . boolean ( )
693716 } ) . required ( ) ,
694717 options : Joi . object ( )
695718} ) . required ( )
0 commit comments