boolean prec2=false;
boolean prec3=false;
int rescount = ro.getResults().size();
//logger.info("RESULTS SEMANTIC START: " + rescount);
QueryObject _qo = qo;
ResultObject _ro = ro;
Boolean first = true;
// if (_qo.getPostedBy() != null) {
// min = _qo.getPostedBy().getMinResults();
// max = _qo.getPostedBy().getMaxResults();
// }else{ //TODO: REMOVE !!!!! --- for test purposes only
// _qo.setPostedBy(PersonFactory.getPerson("mailto:admin@foafrealm.org"));
// }
// if (max == 0) {
// max = 1000;
// }
min = Configuration.MinResultsNumber;
max = Configuration.MaxResultsNumber;
int counter = 6;
SemanticQueryExpansion sqe = new SemanticQueryExpansion(_qo, _ro, queryList,m2resource);
m2resource.foafBoost = BoostFactorKeeper.foafBoost;
while (counter-- > 0) {
if(prec2)prec3=true;
else prec3= false;
//logger.info("FIRST: " + first);
sqe.processQuery(first,prec,m2resource.Visited);
//m2resource.parameters = _qo.getParameters();
m2resource.parameters = queryList;
m2resource.done=true;
System.out.println("POCZ PETLI 2 !!!");
if(Configuration.DEBUG)
{
System.out.println("SIEDZE W PETLI 2 !!!");
int u=0;
while(m2resource.ok!=true){
try {
Thread.sleep(500);
//1000 millisecs
if(u>1)m2resource.iffurther=false;
u++;
}
catch(InterruptedException ex) {
}
}
System.out.println("KON PETLI 2 !!!");
m2resource.iffurther=true;
m2resource.status.clear();
}
queryList=m2resource.parameters;
m2resource.done=false;
m2resource.ok=false;
/*
if(m2resource.parameters.size()!=0)
{
_qo.clearParameters();
for(QueryParameter pars : m2resource.parameters)
_qo.addParameter(pars, true);
}*/
rescount = _ro.getResults().size();
//logger.info("WYNIKI: " + m2resource.resources.toString());
if (rescount >= max) {
prec=true;
prec2=true;
//logger.info("RESULTS SEMANTIC END1: " + rescount);
//return _ro;
_ro = FulltextSearch.getInstance().processQuery(_qo, _ro, first, queryList, prec3);
m2resource.resources = _ro.getResults();
m2resource.done = true;
}else if (rescount <= min){
prec=false;
//logger.info("RESULTS SEMANTIC END2: " + rescount);
//this will allow query expansion in next run of the loop
//run lucene again to get new results
_ro = FulltextSearch.getInstance().processQuery(_qo, _ro, first, queryList, prec3);
// if(first)queryList.clear();
first = false;
m2resource.resources = _ro.getResults();
m2resource.done = true;
sqe.setResultObject(_ro);
}else if (rescount > min && rescount < max){
first = false;
m2resource.resources = _ro.getResults();
m2resource.done = true;
}
//logger.info("END RUN: " + (6-counter));
}