"categoryTree","category","context","size","rank","author","type","collection"};
// TODO support context
String[] types = new String[]{v,v,v,d,d,v,v,v,v,v,v,v,v,d,d,v,v,v};
SearchData data=new SearchDataImpl(suggestions);
SuggestionItem item=null;// this is already here to make sure the classloader load this sinstance
railo.runtime.type.Query qry=new QueryImpl(cols,types,0,"query");
SearchCollection collection;
long time=System.currentTimeMillis();
AddionalAttrs.setAddionalAttrs(contextBytes,contextPassages,contextHighlightBegin,contextHighlightEnd);
try {
for(int i=0;i<collections.length;i++) {
collection=collections[i];
startrow=collection.search(data,qry,criteria,collection.getLanguage(),type,startrow,maxrows,categoryTree,category);
if(maxrows>=0 && qry.getRecordcount()>=maxrows) break;
}
pageContext.setVariable(name,qry);
}
catch(SearchException se) {
throw Caster.toPageException(se);
}
finally{
AddionalAttrs.removeAddionalAttrs();
}
time=System.currentTimeMillis()-time;
Double recSearched=new Double(data.getRecordsSearched());
int len=qry.getRecordcount();
for(int i=1;i<=len;i++) {
qry.setAt("recordssearched",i,recSearched);
}
// status
if(status!=null) {
Struct sct=new StructImpl();
pageContext.setVariable(status, sct);
sct.set(FOUND, new Double(qry.getRecordcount()));
sct.set(SEARCHED, recSearched);
sct.set(KeyConstants._time, new Double(time));
// TODO impl this values
Map s = data.getSuggestion();
if(s.size()>0) {
String key;
Iterator it = s.keySet().iterator();
Struct keywords=new StructImpl();
Struct keywordScore=new StructImpl();
sct.set(KEYWORDS, keywords);
sct.set(KEYWORD_SCORE, keywordScore);
Object obj;
while(it.hasNext()) {
key=(String) it.next();
// FUTURE add SuggestionItem as interface to public interface
// the problem is a conflict between the SuggestionItem version from core and extension
obj=s.get(key);
if(obj instanceof SuggestionItem){
item=(SuggestionItem)obj;
keywords.set(key, item.getKeywords());
keywordScore.set(key, item.getKeywordScore());
}
else {
Class clazz = obj.getClass();
try {
keywords.set(key, clazz.getMethod("getKeywords", new Class[0]).invoke(obj, new Object[0]));