# -*- coding: utf-8 -*- '''测试简单搜索的时间 对比LNC和专题简单搜索改前和改后的性能 ''' import time from libs.parameter import generateEnv from lnc.search.advanced.title import Title # 读取关键词列表 keywordFile = "input/keywords.txt" keywordList = [unicode(x.strip(), "utf-8") for x in open(keywordFile, "r")] # 下面是LNC的简单搜索测试 oldFeatureBrs = Title(generateEnv('point')) oldFeatureBrs.login() newFeatureBrs = Title(generateEnv('stg2')) newFeatureBrs.login() time.sleep(5) allTime = [0, 0] MAX_LOOP = 3 for i, keyword in enumerate(keywordList): if i >= MAX_LOOP: break print i, keyword, t = [[], []] for j in range(5):
#!/usr/bin/env python # -*- coding: utf-8 -*- import time from libs.parameter import generateEnv from lnc.lnc_simple_search import LncSimpleSearchResult from libs import tools # 读取关键词列表 keywordFile = "top1000keyword.csv" keywordList = [unicode(x.strip(), "utf-8") for x in open(keywordFile, "r")] kevinParams = generateEnv('alpha') newFeatureBrs = LncSimpleSearchResult(kevinParams) newFeatureBrs.login() time.sleep(1) kevinTestParams = generateEnv('kevintest') oldFeatureBrs = LncSimpleSearchResult(kevinTestParams) oldFeatureBrs.login() outputFile = open("reports/new-old-top-1000-compare-list.csv", "a") for i, keyword in enumerate(keywordList): print i, keyword newFeatureTitles = newFeatureBrs.get_results_list(keyword) oldFeatureTitles = oldFeatureBrs.get_results_list(keyword) cmpRes = tools.compare_list(newFeatureTitles, oldFeatureTitles) csv_line = tools.generate_csv_list(keyword, cmpRes, newFeatureTitles, oldFeatureTitles)
# -*- coding: utf-8 -*- '''把前1000个关键词的搜索结果保存,为以后的搜索调整做对比''' import time from libs.parameter import generateEnv from lnc.search.simple import Simple simple = Simple(generateEnv('alpha')) simple.login() time.sleep(5) keyword_file = 'input/keywords.txt' keywords = [unicode(k.strip(), 'utf-8') for k in open(keyword_file, 'r')] output = open('output/after-adjust.csv', 'a') b = 1 for keyword in keywords: res = simple.get_results_list(keyword) if res: lines = map(None, (keyword,), (res['total'],), (res['time'],), res['title']) for l in lines: line = [x if x is not None else u'' for x in l] output.write("%s|%s|%s|%s\n" % tuple(line)) output.write("\n") output.flush() simple.close(logout=True)
#!/usr/bin/env python # -*- coding: utf-8 -*- '''测试简单搜索的时间 对比专题简单搜索改前和改后的性能 ''' import time from libs.parameter import generateEnv from module.search import Simple # 读取关键词列表 keywordFile = "top1000keyword.csv" keywordList = [unicode(x.strip(), "utf-8") for x in open(keywordFile, "r")] oldModuleSimpleSearch = Simple(generateEnv('point')) oldModuleSimpleSearch.login() newModuleSimpleSearch = Simple(generateEnv('stg2')) newModuleSimpleSearch.login() time.sleep(5) allTime = [0, 0] MAX_LOOP = 50 for i, keyword in enumerate(keywordList): if i >= MAX_LOOP: break print i, keyword, t = [[], []] for j in range(5):
from cases.entity import lnc_simple_search from libs.parameter import generateEnv kevinParams = generateEnv('alpha') lnc_simple_search.run(kevinParams)
# -*- coding: utf-8 -*- '''测试简单搜索的时间 对比LNC和专题简单搜索改前和改后的性能 ''' import time from libs.parameter import generateEnv from lnc.lnc_simple_search import LncSimpleSearchResult # 读取关键词列表 keywordFile = "top1000keyword.csv" keywordList = [unicode(x.strip(), "utf-8") for x in open(keywordFile, "r")] # 下面是LNC的简单搜索测试 oldFeatureBrs = LncSimpleSearchResult(generateEnv('point')) oldFeatureBrs.login() newFeatureBrs = LncSimpleSearchResult(generateEnv('stg2')) newFeatureBrs.login() time.sleep(5) allTime = [0, 0] MAX_LOOP = 50 for i, keyword in enumerate(keywordList): if i >= MAX_LOOP: break print i, keyword, t = [[], []] for j in range(5):
# -*- coding: utf-8 -*- '''测试简单搜索的时间 对比LNC和专题简单搜索改前和改后的性能 ''' import time from libs.parameter import generateEnv from module.search.advanced.title import Title # 读取关键词列表 keywordFile = "input/keywords.txt" keywordList = [unicode(x.strip(), "utf-8") for x in open(keywordFile, "r")] # 下面是LNC的简单搜索测试 oldFeatureBrs = Title(generateEnv('kevintest')) oldFeatureBrs.login() newFeatureBrs = Title(generateEnv('alpha')) newFeatureBrs.login() time.sleep(5) allTime = [0, 0] MAX_LOOP = 1 for i, keyword in enumerate(keywordList): if i >= MAX_LOOP: break print i, keyword, t = [[], []] for j in range(5):