package stat2;
import tool.makeutf;
import tool.catchword;
class search{
String urlx;
String data=new String[500000];
int datanumber,s,sx,number;
String str1,str2,str;
int x=new int[1000];
int y=new int[1000];
String article=new String[1000];
String title=new String[1000];
String gov=new String[1000];
String name=new String[1000];
String id=new String[1000];
void makedata(String word){
str1="<LIST_INF";
str2="";
makeutf sub5=new makeutf();
word=sub5.makedata(word);
urlx="http://statdb.nstac.go.jp/api/1.0b/app/getStatsList?appId=aeec3b02995623cad42b80c80f73d176b7c77970";
urlx=urlx+"&searchWord="+word;
getdata sub=new getdata();
sub.makedata(urlx);
datanumber=sub.datanumber;
data=sub.data;
sx=0;
for(s=1;s<datanumber+1;s++){
if(data[s].indexOf(str1)>-1)sx=sx+1;
if(data[s].indexOf(str1)>-1)x[sx]=s;
}
number=sx;
sx=0;
for(s=1;s<datanumber+1;s++){
if(data[s].indexOf(str2)>-1)sx=sx+1;
if(data[s].indexOf(str2)>-1)y[sx]=s;
}
for(s=1;s<number+1;s++){
str="";
for(sx=x[s];sx<y[s]+1;sx++){
str=str+data[sx];
}
article[s]=str;
}
int p1,p2;
for(s=1;s<number+1;s++){
str=article[s];
p1=str.indexOf("<TITLE");
p1=str.indexOf(">",p1);
p2=str.indexOf("",p1);
title[s]=str.substring(p1+1,p2);
}
for(s=1;s<number+1;s++){
str=article[s];
p1=str.indexOf("<GOV_ORG");
p1=str.indexOf(">",p1);
p2=str.indexOf("",p1);
p2=str.indexOf("",p1);
id[s]=str.substring(p1+2,p2-1);
}
}
}