solrcloud 随机抽取中文搜索测试
2014-08-13 15:47
323 查看
#!/usr/bin/python
# -*- coding:utf-8 -*-
import solr
import pycurl
import cStringIO
import threading
import time
import os
import sys
import random
import urllib
def test(ip,value):
test_4=urllib.quote(value)
test_1='http://'+ip+'/solr/collection1/select?q=content:'+test_4+'&wt=json&indent=true'
#os.popen('curl %s'%test_1)
buf=cStringIO.StringIO()
c=pycurl.Curl()
c.setopt(c.URL,test_1)
c.setopt(c.WRITEFUNCTION,buf.write)
c.perform()
print buf.getvalue()
buf.close()
if __name__ == '__main__':
c=0
ss=sys.argv[1]
dict={'1':'排','2':'毒','3':'我','4':'有','5':'我','6':'选','7':'择','8':'之','9':'排','10':'毒','11':'方','12':'法','13':'知','14':'多','15':'少','16':'老','1
7':'年','18':'护','19':'理','20':'技','21':'术','22':'进','23':'出','24':'口','25':'业','26':'务','27':'发','28':'展','29':'与','30':'共','31':'享','32':'郑','33':'造'
,'34':'桓','35':'浙','36':'江','37':'大','38':'学','39':'出','40':'版','41':'社','42':'眼','43':'耳','44':'鼻','45':'咽','46':'喉','47':'护','48':'理','49':'许','50':'
建','51':'平','52':'律','53':'程','54':'序','55':'主','56':'义','57':'对','58':'预','59':'防','60':'行','61':'政','62':'的','63':'控','64':'制'}
while True:
for i in range(100):
list_1=[]
for kk in range(random.randint(1,5)):
ee=random.randint(1,64)
dd=dict[str(ee)]
list_1.append(dd)
value="".join(list_1)
print value
time_1=time.time()
print '++++'
a=threading.Thread(target=test,args=(ss,value))
a.start()
time_2=time.time()
d=time_2-time_1
print d
# -*- coding:utf-8 -*-
import solr
import pycurl
import cStringIO
import threading
import time
import os
import sys
import random
import urllib
def test(ip,value):
test_4=urllib.quote(value)
test_1='http://'+ip+'/solr/collection1/select?q=content:'+test_4+'&wt=json&indent=true'
#os.popen('curl %s'%test_1)
buf=cStringIO.StringIO()
c=pycurl.Curl()
c.setopt(c.URL,test_1)
c.setopt(c.WRITEFUNCTION,buf.write)
c.perform()
print buf.getvalue()
buf.close()
if __name__ == '__main__':
c=0
ss=sys.argv[1]
dict={'1':'排','2':'毒','3':'我','4':'有','5':'我','6':'选','7':'择','8':'之','9':'排','10':'毒','11':'方','12':'法','13':'知','14':'多','15':'少','16':'老','1
7':'年','18':'护','19':'理','20':'技','21':'术','22':'进','23':'出','24':'口','25':'业','26':'务','27':'发','28':'展','29':'与','30':'共','31':'享','32':'郑','33':'造'
,'34':'桓','35':'浙','36':'江','37':'大','38':'学','39':'出','40':'版','41':'社','42':'眼','43':'耳','44':'鼻','45':'咽','46':'喉','47':'护','48':'理','49':'许','50':'
建','51':'平','52':'律','53':'程','54':'序','55':'主','56':'义','57':'对','58':'预','59':'防','60':'行','61':'政','62':'的','63':'控','64':'制'}
while True:
for i in range(100):
list_1=[]
for kk in range(random.randint(1,5)):
ee=random.randint(1,64)
dd=dict[str(ee)]
list_1.append(dd)
value="".join(list_1)
print value
time_1=time.time()
print '++++'
a=threading.Thread(target=test,args=(ss,value))
a.start()
time_2=time.time()
d=time_2-time_1
print d
相关文章推荐
- 测试 baidu, google, bing的中文搜索
- lucene3.0+版本中文分词测试+搜索结果+创建索引测试
- Google 随机测试社会化搜索功能
- lucene3.0+版本中文分词测试+搜索结果+创建索引测试
- 34.session随机抽取之本地测试
- [php] 利用PHP生成随机生成中文段落,测试网站内容时专用
- lucene3.0+版本中文分词测试+搜索结果+创建索引测试
- Atitit.并发测试解决方案(2) -----获取随机数据库记录 随机抽取数据 随机排序 原理and实现
- Google 随机测试社会化搜索功能
- Atitit.并发测试解决方案(2) -----获取随机数据库记录 随机抽取数据 随机排序 原理and实现
- Google中文搜索的三大软肋
- Google Print图书网络搜索测试推出
- 百度中文搜索
- 用C#生成随机中文汉字验证码的基本原理
- google推出中文本地搜索服务
- 生成指定个随机字符串--我个人认为基本不会重复(测试时使用6位未见重复现象,完满通过)
- 随机抽取n个记录的SQL(mysql和sqlserver)
- 关于dotnetnuke中文搜索问题的分析+临时方法
- 用C#生成随机中文汉字验证码的基本原理
- sps中的全文搜索和英文版sqlserver搜索中文的方法