Ejemplo n.º 1
0
def get_brands(request):
    q = 'client_id:%s AND -type:variable' % request.client.client.id
    params = {}
    params['rows'] = 200
    solr_result = solr_search(q,**params)
    br = [int(doc['brand_id']) for doc in solr_result.results]
    brands = Brand.objects.filter(id__in=br)
    return brands
Ejemplo n.º 2
0
Archivo: home.py Proyecto: daasara/riba
def get_brands(request):
    q = 'client_id:%s AND -type:variable' % request.client.client.id
    params = {}
    params['rows'] = 200
    solr_result = solr_search(q, **params)
    br = [int(doc['brand_id']) for doc in solr_result.results]
    brands = Brand.objects.filter(id__in=br)
    return brands
Ejemplo n.º 3
0
Archivo: home.py Proyecto: daasara/riba
def suggest(request):
    if request.method == 'GET':
        if 'chars' not in request.GET:
            return HttpResponse()
        q = request.GET['chars']
        from utils.solrutils import solr_search
        q += ' AND currency:inr AND client_id: %s' % request.client.client.id
        search_result = solr_search(q, fields='title')
        titles = [doc['title'] for doc in search_result.results]
        result = []
        for t in titles:
            tt = dict(text=t)
            result.append(tt)
        return HttpResponse(simplejson.dumps(result))
    else:
        return HttpResponse()
Ejemplo n.º 4
0
def suggest(request):
    if request.method == 'GET':
        if 'chars' not in request.GET:
            return HttpResponse()
        q = request.GET['chars']
        from utils.solrutils import solr_search
        q += ' AND currency:inr AND client_id: %s' % request.client.client.id
        search_result = solr_search(q,fields='title')
        titles = [doc['title'] for doc in search_result.results]
        result = []
        for t in titles:
            tt = dict(text = t)
            result.append(tt)
        return HttpResponse(simplejson.dumps(result))
    else:
        return HttpResponse()
Ejemplo n.º 5
0
def compute(sync):
    _client_id = 5
    last_month = datetime.now() + timedelta(days=-30)
    # Get srcs of products created before 1 month
    new_rate_charts = SellerRateChart.objects.select_related('product', 'product__status').filter(product__is_online=True, seller__client=_client_id,\
                      product__created_on__gte=last_month).order_by("-product__created_on")[:200]
    new_products = []
    for src in new_rate_charts:
        new_products.append(src.product)
    # New arrivals products should be atleast 45 items
    if len(new_products) < 45:
        new_rate_charts = SellerRateChart.objects.select_related('product', 'product__status').filter(product__is_online=True,\
                          seller__client=_client_id).order_by("-product__created_on")[:200]
        new_products = []
        for src in new_rate_charts:
            new_products.append(src.product)

    # Create popular_deal tag, for indexing products into solr
    tag_type = 'new_arrivals'
    tag = Tag.objects.filter(tag=tag_type)
    if not tag:
        tag = Tag(tag=tag_type)
        tag.display_name = tag_type.capitalize()
        tag.save()
    else:
        tag = tag[0]
    products = []
    # variant_products contains product obj of {normal, variant} type
    # so replace variant products by variable 
    # to reindex in solr
    variant_products = new_products
    productvariants = ProductVariant.objects.select_related('blueprint', 'variant').filter(variant__in=variant_products)
    variant_product_map = {}
    for pv in productvariants:
        # get {variable : variant} mapping
        variant_product_map[pv.variant] = pv.blueprint
    for product in variant_products:
        prod = product
        if product.type == 'variant':
            try:
                # get corresponding variable of variant from variable:variant mapping
                prod = variant_product_map[product]
            except KeyError:
                continue
        if prod not in products:
            products.append(prod)
    # products list contains all products with type {variable, normal}
    product_ids_to_reindexed = []
    for product in products:
        try:
            pt = ProductTags.objects.select_related('product').get(type=tag_type, product=product, tag=tag)
        except ProductTags.DoesNotExist:
            pt = ProductTags()
            pt.type = tag_type
            pt.product = product  
            pt.tag = tag
            pt.save()
            # if product is not included in previous list then
            # then create ProductTag for it and reindex it 
        product_ids_to_reindexed.append(int(product.id))
    # Get previously indexed new arrivals from solr
    from utils.solrutils import solr_search
    q = 'tag_id:%s AND client_id:%s' % (tag.id, _client_id)
    params = {'rows':1000}
    solr_result = solr_search(q, fields='id', highlight=None, score=True, sort=None, sort_order="asc", operation='/select',\
                  active_product_query='', boost_query='', request=None, **params)

    indexed_new_arrivals = [int(res['id']) for res in solr_result.results]

    # ProductTags of (previously_indexed_new_arrivals - current_new_arrivals)
    # should to be removed
    new_arrivals_to_remove = set(indexed_new_arrivals) - set(product_ids_to_reindexed)
    product_ids_to_reindexed = set(product_ids_to_reindexed) - set(indexed_new_arrivals)
    log.info("New Arrivals ID:: %s" % product_ids_to_reindexed)
    sync.found = len(indexed_new_arrivals)
    sync.deletes = len(new_arrivals_to_remove)
    sync.add = len(product_ids_to_reindexed)
    sync.save()
    if not product_ids_to_reindexed:
        log.info("Found no new_arrivals")    
        return
    products_to_reindexed = Product.objects.filter(id__in=product_ids_to_reindexed)
    
    removed_new_arrivals = []
    for product_tag in ProductTags.objects.select_related('product').filter(product__in=new_arrivals_to_remove, tag=tag):
        removed_new_arrivals.append(product_tag.product)
        product_tag.delete()

    for product in products_to_reindexed:
        # Reindex:
        # 1) new product set (to add tag entry into solr)
        # 2) old tagged product set (to delete tag entry from solr)
        product.update_solr_index()
    for product in removed_new_arrivals:
        product.update_solr_index()
Ejemplo n.º 6
0
def index_popular_deals(popular_pending_deals,
                        popular_confirmed_deals,
                        client_id=5):
    popular_products = popular_pending_deals + popular_confirmed_deals
    popular_products = Product.objects.filter(id__in=popular_products,
                                              is_online=True)
    if not popular_products:
        popular_orders = OrderCountByState.objects.select_related('product').filter(client=client_id,\
                         product__is_online=True).order_by('-order_count')[:200]
        popular_products = [order.product for order in popular_orders]
    # Create popular_deal tag, for indexing products into solr
    popular_type = 'popular_deals'
    tag = Tag.objects.filter(tag=popular_type)
    if not tag:
        tag = Tag(tag=popular_type)
        tag.display_name = popular_type.capitalize()
        tag.save()
    else:
        tag = tag[0]
    product_ids_to_reindexed = []
    products = []
    variant_products = popular_products
    productvariants = ProductVariant.objects.select_related(
        'blueprint', 'variant').filter(variant__in=variant_products)
    variant_product_map = {}
    for pv in productvariants:
        variant_product_map[pv.variant] = pv.blueprint
    for product in variant_products:
        prod = product
        if product.type == 'variant':
            try:
                prod = variant_product_map[product]
            except KeyError:
                continue
        if prod not in products:
            products.append(prod)
    for product in products:
        try:
            pt = ProductTags.objects.select_related('product').get(
                type=popular_type, product=product, tag=tag)
        except ProductTags.DoesNotExist:
            pt = ProductTags()
            pt.type = popular_type
            pt.product = product
            pt.tag = tag
            pt.save()
            product_ids_to_reindexed.append(int(product.id))

    from utils.solrutils import solr_search
    q = 'tag_id:%s AND client_id:%s' % (tag.id, client_id)
    params = {'rows': 1000}
    solr_result = solr_search(q, fields='id', highlight=None, score=True, sort=None, sort_order="asc", operation='/select',\
                  active_product_query='', boost_query='', request=None, **params)

    indexed_popular_deals = [int(res['id']) for res in solr_result.results]

    popular_deals_to_remove = set(indexed_popular_deals) - set(
        product_ids_to_reindexed)
    product_ids_to_reindexed = set(product_ids_to_reindexed) - set(
        indexed_popular_deals)
    log.info("Popular Deals ID:: %s" % product_ids_to_reindexed)
    sync.found = len(indexed_popular_deals)
    sync.deletes = len(popular_deals_to_remove)
    sync.add = len(product_ids_to_reindexed)
    sync.save()
    if not product_ids_to_reindexed:
        log.info("Found no popular_deals")
        return

    products_to_reindexed = Product.objects.filter(
        id__in=product_ids_to_reindexed)

    removed_popular_deals = []
    for product_tag in ProductTags.objects.select_related('product').filter(
            product__in=popular_deals_to_remove, tag=tag):
        removed_popular_deals.append(product_tag.product)
        product_tag.delete()

    for product in products_to_reindexed:
        # Reindex:
        # 1) new product set (to add tag entry into solr)
        # 2) old tagged product set (to delete tag entry from solr)
        product.update_solr_index()
    for product in removed_popular_deals:
        product.update_solr_index()
Ejemplo n.º 7
0
            except:
                try:
                    print key, " key not present."
                    merchantTypeKey = MerchantTypeKey()
                    merchantTypeKey.percentage = percentage
                    merchantTypeKey.key = key
                    merchantTypeKey.network = network
                    merchantTypeKey.save()
                    print "Okay merchant key created -", merchantTypeKey
                except:
                    print "Passing ", key
                    pass
        params = {'rows': 200}
        q = 'tag_id:%s' % tag.id
        try:
            solr_result = solr_search(q, fields='id', **params)
            prod_ids_in_solr = [int(doc['id']) for doc in solr_result.results]
            total_results = int(solr_result.numFound)
            print "Okay ", total_results, " products in prod_ids_in_solr----", prod_ids_in_solr, "\n"

            commision_on = CommisionOn.objects.select_related(
                'seller_rate_chart', 'product',
                'commision').filter(network=network)
            if commision_on:
                error = ''

                count = 0
                itz_seller_chart_ids = []
                itz_product_ids = []
                for itz_prods in commision_on:
                    count += 1
Ejemplo n.º 8
0
def itz_homepage(request):
    error = ''
    itz_offer = {}
    hero_deal = {}
    mega_menu_categories = ''
    _client = request.client.client
    
    net_details = save_franc_network_in_dict(request)
    if not 'is_network' in net_details or not 'is_franchise' in net_details or net_details['is_network']:
        return HttpResponseRedirect('/accounts/login/')

    home_page_ctxt_key = 'itz_homepage#%s' % (_client.id)
    home_page_context = cache.get(home_page_ctxt_key)
    
    if not home_page_context:
        tag = Tag.objects.filter(tag='itz')
        if tag:
            tag = tag[0]
            q = 'tag_id:%s' % tag.id
            params = {}
            params['rows'] = 1000
            itz_solr_result = solr_search(q, fields='id', **params)
            #itz_categories_solr = search_browser_filter(request, **{'tag_ids' : tag.id })
        else:
            error = "No Itz tag found"
            home_page_context = {'error':error,}
        if error or itz_solr_result.numFound == 0:
            error = "No Itz products found. Add products from admin site."
            home_page_context = {'error':error,}
        else:
            itz_product_ids = [res['id'] for res in itz_solr_result.results]
            itz_seller_charts = SellerRateChart.objects.filter(product__in=itz_product_ids)
            
            mega_menu_categories = MegaDropDown.objects.select_related("category").filter(type="menu_level2_category", client=_client).order_by('sort_order')
            for cat in mega_menu_categories:
                itz_offer[cat.category.id] = {}
                temp_dict = search_browser_filter(request,**{ 'category': cat.category })
                if 'total_results' in temp_dict:
                    itz_offer[cat.category.id]['total_results'] = temp_dict['total_results']
                if 'filter_form' in temp_dict:
                    itz_offer[cat.category.id]['gmin'] = temp_dict['filter_form'].gmin
                if 'products' in temp_dict:
                    itz_offer[cat.category.id]['products'] = temp_dict['products']
            
            from dealprops.models import DailyDeal, DailyDealImage
            hero_deals = DailyDeal.objects.select_related('id', 'type').filter(status='published', starts_on__lte=datetime.now(),ends_on__gte=datetime.now(), client=_client, type = 'hero_deal').order_by('-starts_on')[:1]
            
            if hero_deals:
                hero_deal_obj = hero_deals[0]
                
                if hero_deal_obj:
                    hero_deal_rate_chart = None
                    daily_deal_products = hero_deal_obj.dailydealproduct_set.all()
                    
                    if daily_deal_products:
                        daily_deal_product = daily_deal_products[0]
                        hero_deal_rate_chart = daily_deal_product.product.primary_rate_chart()
                        
                        if hero_deal_rate_chart in itz_seller_charts:
                            hero_deal['deal'] = hero_deal_obj
                            hero_deal['url'] = hero_deal_rate_chart.product.url()
                            
                            try:
                                hero_deal_image = DailyDealImage.objects.get(daily_deal=hero_deal_obj)
                            except DailyDealImage.MultipleObjectsReturned:
                                hero_deal_image = DailyDealImage.objects.filter(daily_deal=hero_deal_obj).order_by('order')[0]
                            except DailyDealImage.DoesNotExist:
                                pass
                            if hero_deal_image:
                                hero_deal['main_banner'] = hero_deal_image.banner
            home_page_context = {
                                    'net_details':net_details,
                                    'error':error,
                                    'itz_offer':itz_offer,
                                    'mega_menu_categories':mega_menu_categories,
                                    'hero_deal':hero_deal,
                                }
            cache.set(home_page_ctxt_key, home_page_context, 1800)

    home_page_context['request'] = request
    return render_to_response('itz_homepage.html', home_page_context,
        context_instance=RequestContext(request))
Ejemplo n.º 9
0
def mark_itz_cat_hero(request, commission_on_id):
    error = ''
    is_marked_hero = False
    tag_hero_name = 'itz_hero'
    list_type = 'itz_offer'
    
    net_details = save_franc_network_in_dict(request)

    tag_hero = Tag.objects.filter(tag=tag_hero_name)
    if tag_hero:
        tag_hero = tag_hero[0]
    else:
        error = "No ITZ hero tag found"
    
    if not error:
        try:
            commision_on = CommisionOn.objects.get(network = net_details['network'], id = commission_on_id)
            this_prod_id = int(commision_on.seller_rate_chart.product.id)
            
            from catalog.models import ProductTags, Product
            try:
                pt = ProductTags.objects.get(type = list_type, product = commision_on.seller_rate_chart.product, tag=tag_hero)
                is_marked_hero = True
            except ProductTags.DoesNotExist:
                pt = ProductTags(type = list_type, product = commision_on.seller_rate_chart.product, tag=tag_hero)
                pt.save()
                is_marked_hero = True
            
                commision_on.seller_rate_chart.product.update_solr_index()
                parent_cat_dict = get_categories_by_id(request, [str(commision_on.seller_rate_chart.product.id)])
                parent_c1_id = parent_cat_dict['c1_categories'][0].id
            
                from utils.solrutils import solr_search
                params = {'rows':200}
                q = 'tag_id:%s AND category_id:%s' % (tag_hero.id, parent_c1_id)
                
                try:
                    solr_result = solr_search(q, **params)
                    prod_ids_in_solr = [int(doc['id']) for doc in solr_result.results]
                    if this_prod_id in prod_ids_in_solr:
                        prod_ids_in_solr.remove(this_prod_id)
                    
                    for prod in prod_ids_in_solr:
                        try:
                            pt = ProductTags.objects.get(type = list_type, product = prod, tag=tag_hero).delete()
                        except:
                            pass
                        try:
                            product = Product.objects.get(id = prod)
                            product.update_solr_index()
                        except:
                            pass
                    
                except:
                    error = "Solr query failed. Query:",q
        except:
            error = 'Itz product not found'
    
    if not error:
        ajax_response = dict(status='success', is_marked_hero = is_marked_hero, error=error)
    else:
        ajax_response = dict(status='failed', error=error)
    
    return HttpResponse(simplejson.dumps(ajax_response))
Ejemplo n.º 10
0
                     commision_on = CommisionOn.objects.select_related('seller_rate_chart', 'product', 'commision').filter(network = net_details['network'])[startOrderIndex : startOrderIndex + items_per_page]
                 except Exception,e:
                     log.exception('Exception while itz product history: %s' % repr(e))
                     pass
             else:
                 error = 'No Itz products found'
         except:
             error = 'Something went wrong in getting itz products '
     
     tag_hero = Tag.objects.filter(tag="itz_hero")
     if tag_hero:
         tag_hero = tag_hero[0]
     from utils.solrutils import solr_search
     params = {'rows':200}
     q = 'tag_id:%s' % tag_hero.id
     solr_result = solr_search(q, **params)
     prod_ids_in_solr = [int(doc['id']) for doc in solr_result.results]
     
 else:
     return HttpResponseRedirect('/accounts/login/')
 return render_to_response('performance/icw_catalog.html',
     {
         'request':request,
         'error':error,
         'prod_ids_in_solr':prod_ids_in_solr,
         'show_add_product' : show_add_product,
         'pagination':pagination,
         'net_details':net_details,
         'commision_on':commision_on,
         'sku':sku,
         'tab':4,
Ejemplo n.º 11
0
     except:
         try:
             print key, " key not present."
             merchantTypeKey = MerchantTypeKey()
             merchantTypeKey.percentage = percentage
             merchantTypeKey.key = key
             merchantTypeKey.network = network
             merchantTypeKey.save()
             print "Okay merchant key created -",merchantTypeKey
         except:
             print "Passing ",key
             pass
 params = {'rows':200}
 q = 'tag_id:%s' % tag.id
 try:
     solr_result = solr_search(q, fields ='id', **params)
     prod_ids_in_solr = [int(doc['id']) for doc in solr_result.results]
     total_results = int(solr_result.numFound)
     print "Okay ",total_results," products in prod_ids_in_solr----",prod_ids_in_solr, "\n"
     
     commision_on = CommisionOn.objects.select_related('seller_rate_chart', 'product', 'commision').filter(network = network)
     if commision_on:
         error = ''
         
         count = 0
         itz_seller_chart_ids = []
         itz_product_ids = []
         for itz_prods in commision_on:
             count += 1
             try:
                 src = SellerRateChart.objects.get(sku= itz_prods.seller_rate_chart.sku, seller__client=client_id)
Ejemplo n.º 12
0
def index_popular_deals(popular_pending_deals, popular_confirmed_deals, client_id=5):
    popular_products = popular_pending_deals + popular_confirmed_deals
    popular_products = Product.objects.filter(id__in=popular_products, is_online=True)
    if not popular_products:
        popular_orders = OrderCountByState.objects.select_related('product').filter(client=client_id,\
                         product__is_online=True).order_by('-order_count')[:200]
        popular_products = [order.product for order in popular_orders]
    # Create popular_deal tag, for indexing products into solr
    popular_type = 'popular_deals'
    tag = Tag.objects.filter(tag=popular_type)
    if not tag:
        tag = Tag(tag=popular_type)
        tag.display_name = popular_type.capitalize()
        tag.save()
    else:
        tag = tag[0]
    product_ids_to_reindexed = []
    products = []
    variant_products = popular_products
    productvariants = ProductVariant.objects.select_related('blueprint', 'variant').filter(variant__in=variant_products)
    variant_product_map = {}
    for pv in productvariants:
        variant_product_map[pv.variant] = pv.blueprint
    for product in variant_products:
        prod = product
        if product.type == 'variant':
            try:
                prod = variant_product_map[product]
            except KeyError:
                continue
        if prod not in products:
            products.append(prod)
    for product in products:
        try:
            pt = ProductTags.objects.select_related('product').get(type=popular_type, product=product, tag=tag)
        except ProductTags.DoesNotExist:
            pt = ProductTags()
            pt.type = popular_type
            pt.product = product  
            pt.tag = tag
            pt.save()
            product_ids_to_reindexed.append(int(product.id))

    from utils.solrutils import solr_search
    q = 'tag_id:%s AND client_id:%s' % (tag.id, client_id)
    params = {'rows':1000}
    solr_result = solr_search(q, fields='id', highlight=None, score=True, sort=None, sort_order="asc", operation='/select',\
                  active_product_query='', boost_query='', request=None, **params)

    indexed_popular_deals = [int(res['id']) for res in solr_result.results]

    popular_deals_to_remove = set(indexed_popular_deals) - set(product_ids_to_reindexed)
    product_ids_to_reindexed = set(product_ids_to_reindexed) - set(indexed_popular_deals)
    log.info("Popular Deals ID:: %s" % product_ids_to_reindexed)
    sync.found = len(indexed_popular_deals)
    sync.deletes = len(popular_deals_to_remove)
    sync.add = len(product_ids_to_reindexed)
    sync.save()
    if not product_ids_to_reindexed:
        log.info("Found no popular_deals")
        return

    products_to_reindexed = Product.objects.filter(id__in=product_ids_to_reindexed)

    removed_popular_deals= []
    for product_tag in ProductTags.objects.select_related('product').filter(product__in=popular_deals_to_remove, tag=tag):
        removed_popular_deals.append(product_tag.product)
        product_tag.delete()

    for product in products_to_reindexed:
        # Reindex:
        # 1) new product set (to add tag entry into solr)
        # 2) old tagged product set (to delete tag entry from solr)
        product.update_solr_index()
    for product in removed_popular_deals:
        product.update_solr_index()
Ejemplo n.º 13
0
def compute(sync):
    _client_id = 5
    last_month = datetime.now() + timedelta(days=-30)
    # Get srcs of products created before 1 month
    new_rate_charts = SellerRateChart.objects.select_related('product', 'product__status').filter(product__is_online=True, seller__client=_client_id,\
                      product__created_on__gte=last_month).order_by("-product__created_on")[:200]
    new_products = []
    for src in new_rate_charts:
        new_products.append(src.product)
    # New arrivals products should be atleast 45 items
    if len(new_products) < 45:
        new_rate_charts = SellerRateChart.objects.select_related('product', 'product__status').filter(product__is_online=True,\
                          seller__client=_client_id).order_by("-product__created_on")[:200]
        new_products = []
        for src in new_rate_charts:
            new_products.append(src.product)

    # Create popular_deal tag, for indexing products into solr
    tag_type = 'new_arrivals'
    tag = Tag.objects.filter(tag=tag_type)
    if not tag:
        tag = Tag(tag=tag_type)
        tag.display_name = tag_type.capitalize()
        tag.save()
    else:
        tag = tag[0]
    products = []
    # variant_products contains product obj of {normal, variant} type
    # so replace variant products by variable
    # to reindex in solr
    variant_products = new_products
    productvariants = ProductVariant.objects.select_related(
        'blueprint', 'variant').filter(variant__in=variant_products)
    variant_product_map = {}
    for pv in productvariants:
        # get {variable : variant} mapping
        variant_product_map[pv.variant] = pv.blueprint
    for product in variant_products:
        prod = product
        if product.type == 'variant':
            try:
                # get corresponding variable of variant from variable:variant mapping
                prod = variant_product_map[product]
            except KeyError:
                continue
        if prod not in products:
            products.append(prod)
    # products list contains all products with type {variable, normal}
    product_ids_to_reindexed = []
    for product in products:
        try:
            pt = ProductTags.objects.select_related('product').get(
                type=tag_type, product=product, tag=tag)
        except ProductTags.DoesNotExist:
            pt = ProductTags()
            pt.type = tag_type
            pt.product = product
            pt.tag = tag
            pt.save()
            # if product is not included in previous list then
            # then create ProductTag for it and reindex it
        product_ids_to_reindexed.append(int(product.id))
    # Get previously indexed new arrivals from solr
    from utils.solrutils import solr_search
    q = 'tag_id:%s AND client_id:%s' % (tag.id, _client_id)
    params = {'rows': 1000}
    solr_result = solr_search(q, fields='id', highlight=None, score=True, sort=None, sort_order="asc", operation='/select',\
                  active_product_query='', boost_query='', request=None, **params)

    indexed_new_arrivals = [int(res['id']) for res in solr_result.results]

    # ProductTags of (previously_indexed_new_arrivals - current_new_arrivals)
    # should to be removed
    new_arrivals_to_remove = set(indexed_new_arrivals) - set(
        product_ids_to_reindexed)
    product_ids_to_reindexed = set(product_ids_to_reindexed) - set(
        indexed_new_arrivals)
    log.info("New Arrivals ID:: %s" % product_ids_to_reindexed)
    sync.found = len(indexed_new_arrivals)
    sync.deletes = len(new_arrivals_to_remove)
    sync.add = len(product_ids_to_reindexed)
    sync.save()
    if not product_ids_to_reindexed:
        log.info("Found no new_arrivals")
        return
    products_to_reindexed = Product.objects.filter(
        id__in=product_ids_to_reindexed)

    removed_new_arrivals = []
    for product_tag in ProductTags.objects.select_related('product').filter(
            product__in=new_arrivals_to_remove, tag=tag):
        removed_new_arrivals.append(product_tag.product)
        product_tag.delete()

    for product in products_to_reindexed:
        # Reindex:
        # 1) new product set (to add tag entry into solr)
        # 2) old tagged product set (to delete tag entry from solr)
        product.update_solr_index()
    for product in removed_new_arrivals:
        product.update_solr_index()