<commit_before># -*- coding: utf-8 -*-
"""
Copyright (C) 2016, <NAME>
Contributed by <NAME> (<EMAIL>)
This file is part of BSD license

<https://opensource.org/licenses/BSD-3-Clause>
"""
import datetime
from django.utils import timezone
from django.shortcuts import render
from django.shortcuts import redirect
from django.http import JsonResponse
from django.db.models import Q
from trip.models import Trip
from trip.models import ExRate
from trip.models import FavoriteTrip
from trip.models import CustomizedTripPlan
from trip.models import CustomizedTripPlanItem
from account.models import UserAccount
from itertools import chain
from geopy.geocoders import GoogleV3

#搜尋過瀘與排序 trip 
def tripFilter(request=None):
    #從 session 取得使用者的幣別匯率資訊
    strUserCurrency = getUserCurrencyFromSession(request=request)
    matchedExRate = ExRate.objects.get(strCurrencyName=strUserCurrency)
    fUsdToUserCurrencyExRate = matchedExRate.fUSDollar
    # query 資訊
    intPageIndex = int(request.GET.get("page", "1"))
    strKeyword = request.GET.get("keyword", None)
    strMinBudget = request.GET.get("min_budget", None)
    strMaxBudget = request.GET.get("max_budget", None)
    strDateFrom = request.GET.get("date_from", None)
    strDateTo = request.GET.get("date_to", None)
    strMinDurationHour = request.GET.get("min_duration", None)
    strMaxDurationHour = request.GET.get("max_duration", None)
    strStyle = request.GET.get("style", None)
    strGuideLanguage = request.GET.get("guide_language", None)
    strOption = request.GET.get("option", None)
    strOrderBy = request.GET.get("order_by", None)
    # filter 
    lstDicTripData = []
    qsetMatchedTrip = Trip.objects.all().filter()
    if strKeyword:
        #queryKeyword = Q(strTitle__iregex="^.*%s.*$"%strKeyword) | Q(strLocation__iregex="^.*%s.*$"%strKeyword) | Q(strIntroduction__iregex="^.*%s.*$"%strKeyword)
        queryKeyword = Q(strTitle__iregex="^.*%s.*$"%strKeyword) | Q(strLocation__iregex="^.*%s.*$"%strKeyword)
        qsetMatchedTrip = qsetMatchedTrip.filter(queryKeyword)
    if strStyle:
        qsetMatchedTrip = qsetMatchedTrip.filter(strStyle__iregex="^.*%s.*$"%strStyle)
    if strGuideLanguage:
        qsetMatchedTrip = qsetMatchedTrip.filter(strGuideLanguage__iregex="^.*%s.*$"%strGuideLanguage)
    if strMinBudget and strMaxBudget:<commit_msg>del search keyword in introduction<commit_after># -*- coding: utf-8 -*-
"""
Copyright (C) 2016, <NAME>
Contributed by <NAME> (<EMAIL>)
This file is part of BSD license

<https://opensource.org/licenses/BSD-3-Clause>
"""
import datetime
from django.utils import timezone
from django.shortcuts import render
from django.shortcuts import redirect
from django.http import JsonResponse
from django.db.models import Q
from trip.models import Trip
from trip.models import ExRate
from trip.models import FavoriteTrip
from trip.models import CustomizedTripPlan
from trip.models import CustomizedTripPlanItem
from account.models import UserAccount
from itertools import chain
from geopy.geocoders import GoogleV3

#搜尋過瀘與排序 trip 
def tripFilter(request=None):
    #從 session 取得使用者的幣別匯率資訊
    strUserCurrency = getUserCurrencyFromSession(request=request)
    matchedExRate = ExRate.objects.get(strCurrencyName=strUserCurrency)
    fUsdToUserCurrencyExRate = matchedExRate.fUSDollar
    # query 資訊
    intPageIndex = int(request.GET.get("page", "1"))
    strKeyword = request.GET.get("keyword", None)
    strMinBudget = request.GET.get("min_budget", None)
    strMaxBudget = request.GET.get("max_budget", None)
    strDateFrom = request.GET.get("date_from", None)
    strDateTo = request.GET.get("date_to", None)
    strMinDurationHour = request.GET.get("min_duration", None)
    strMaxDurationHour = request.GET.get("max_duration", None)
    strStyle = request.GET.get("style", None)
    strGuideLanguage = request.GET.get("guide_language", None)
    strOption = request.GET.get("option", None)
    strOrderBy = request.GET.get("order_by", None)
    # filter 
    lstDicTripData = []
    qsetMatchedTrip = Trip.objects.all().filter()
    if strKeyword:
        queryKeyword = Q(strTitle__iregex="^.*%s.*$"%strKeyword) | Q(strLocation__iregex="^.*%s.*$"%strKeyword)
        qsetMatchedTrip = qsetMatchedTrip.filter(queryKeyword)
    if strStyle:
        qsetMatchedTrip = qsetMatchedTrip.filter(strStyle__iregex="^.*%s.*$"%strStyle)
    if strGuideLanguage:
        qsetMatchedTrip = qsetMatchedTrip.filter(strGuideLanguage__iregex="^.*%s.*$"%strGuideLanguage)
    if strMinBudget and strMaxBudget:
{'fraction_non_alphanumeric': 0.11987591402614668, 'fraction_numerical': 0.0035453135386660757, 'mean_word_length': 4.847150259067358, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5358205', 'n_tokens_mistral': 1527, 'n_tokens_neox': 1537, 'n_words': 301}