Beispiel #1
0
    def get_query_keyword(self):
        keyword = self.request.GET.get('query', '')
        if not keyword:
            return {}

        user = self.request.user
        page = get_int(self.request.GET.get('page', 0))
        page = 0 if page - 1 < 0 else page - 1

        feed_id_list = UserAcceptTask.objects.filter(user=user, ).values_list(
            'feed__feed_obj_id',
            flat=True,
        )
        search_params = {
            'start': 0,
            'size': 100,
            'feed_type': 1,
            'keywords': keyword,
            'ids_list': ','.join(list(feed_id_list))
        }
        search_result = ParseUtils.search_job(search_params)
        feed_data = search_result.get('data', {}).get('results', [])
        return {
            'feed__feed_obj_id__in':
            [i['id'] for i in feed_data if i.get('id')]
        }
Beispiel #2
0
    def get_query_keyword(self):
        keyword = self.request.GET.get('query', '')
        if not keyword:
            return {}

        user = self.request.user
        page = get_int(self.request.GET.get('page', 0))
        page = 0 if page - 1 < 0 else page - 1

        feed_id_list = UserAcceptTask.objects.filter(
            user=user,
        ).values_list(
            'feed__feed_obj_id',
            flat=True,
        )
        search_params = {
            'start': 0,
            'size': 100,
            'feed_type': 1,
            'keywords': keyword,
            'ids_list': ','.join(list(feed_id_list))
        }
        search_result = ParseUtils.search_job(search_params)
        feed_data = search_result.get('data', {}).get('results', [])
        return {
            'feed__feed_obj_id__in': [i['id'] for i in feed_data if i.get('id')]
        }
Beispiel #3
0
    def get_queryset(self):
        exclude_task_id_list = self.exclude_feed_id_list()

        self.init_all_citys()
        query_citys = self.get_query_citys()
        query_keywords = self.get_query_keywords()

        search_params = {
            'feed_type': 1,
            'start': 0,
            'citys': query_citys,
            'query_feed_result': True,
            'keywords': query_keywords,
            'need_company': True,
            'size': 100,
            'ids_list_nin': ','.join(exclude_task_id_list),
            'time_field_gte': 'feed_expire_time:-7',
            'default_operator': 'and',
        }

        search_result = ParseUtils.search_job(search_params)
        feed_data = search_result.get('data', {}).get('results', [])
        feed_obj_id_list = [i['id'] for i in feed_data if i.get('id')]
        now = datetime.datetime.now()

        task_query = Feed.objects.filter(
            deleted=False,
            feed_expire_time__gt=now,
            feed_obj_id__in=feed_obj_id_list,
        ).select_related(
            'company',
            'user',
        ).prefetch_related(
            'job_domain',
            'company_prefer',
            'company__category',
        )
        return task_query
Beispiel #4
0
    def get_queryset(self):
        exclude_task_id_list = self.exclude_feed_id_list()

        self.init_all_citys()
        query_citys = self.get_query_citys()
        query_keywords = self.get_query_keywords()

        search_params = {
            'feed_type': 1,
            'start': 0,
            'citys': query_citys,
            'query_feed_result': True,
            'keywords': query_keywords,
            'need_company': True,
            'size': 100,
            'ids_list_nin': ','.join(exclude_task_id_list),
            'time_field_gte': 'feed_expire_time:-7',
            'default_operator': 'and',
        }

        search_result = ParseUtils.search_job(search_params)
        feed_data = search_result.get('data', {}).get('results', [])
        feed_obj_id_list = [i['id'] for i in feed_data if i.get('id')]
        now = datetime.datetime.now()

        task_query = Feed.objects.filter(
            deleted=False,
            feed_expire_time__gt=now,
            feed_obj_id__in=feed_obj_id_list,
        ).select_related(
            'company',
            'user',
        ).prefetch_related(
            'job_domain',
            'company_prefer',
            'company__category',
        )
        return task_query