@ -39,6 +39,7 @@ import net.yacy.kelondro.util.ISO639;
import net.yacy.peers.graphics.ProfilingGraph ;
import net.yacy.search.EventTracker ;
import net.yacy.search.Switchboard ;
import net.yacy.search.SwitchboardConstants ;
import net.yacy.search.query.QueryParams ;
import net.yacy.search.query.SearchEvent ;
import net.yacy.search.query.SearchEventCache ;
@ -68,6 +69,14 @@ public class yacysearchtrailer {
}
final RequestHeader . FileType fileType = header . fileType ( ) ;
final boolean authorized = sb . verifyAuthentication ( header ) ;
final boolean clustersearch = sb . isRobinsonMode ( ) & & sb . getConfig ( SwitchboardConstants . CLUSTER_MODE , "" ) . equals ( SwitchboardConstants . CLUSTER_MODE_PUBLIC_CLUSTER ) ;
final boolean indexReceiveGranted = sb . getConfigBool ( SwitchboardConstants . INDEX_RECEIVE_ALLOW_SEARCH , true ) | | clustersearch ;
boolean p2pmode = sb . peers ! = null & & sb . peers . sizeConnected ( ) > 0 & & indexReceiveGranted ;
boolean global = post = = null | | ( post . get ( "resource-switch" , post . get ( "resource" , "local" ) ) . equals ( "global" ) & & p2pmode ) ;
boolean stealthmode = p2pmode & & ! global ;
prop . put ( "resource-select" , ! authorized ? 0 : stealthmode ? 2 : global ? 1 : 0 ) ;
// compose search navigation
// namespace navigators
@ -99,7 +108,7 @@ public class yacysearchtrailer {
nav = "" ;
}
prop . put ( fileType , "nav-namespace_element_" + i + "_name" , name ) ;
prop . put ( fileType , "nav-namespace_element_" + i + "_url" , QueryParams . navurl ( fileType . name ( ) . toLowerCase ( ) , 0 , theSearch . query , nav ). toString ( ) ) ;
prop . put ( fileType , "nav-namespace_element_" + i + "_url" , QueryParams . navurl ( fileType . name ( ) . toLowerCase ( ) , 0 , theSearch . query , nav , false ). toString ( ) ) ;
prop . put ( "nav-namespace_element_" + i + "_count" , count ) ;
prop . put ( "nav-namespace_element_" + i + "_nl" , 1 ) ;
i + + ;
@ -141,7 +150,7 @@ public class yacysearchtrailer {
nav = "" ;
}
prop . put ( fileType , "nav-domains_element_" + i + "_name" , name ) ;
prop . put ( fileType , "nav-domains_element_" + i + "_url" , QueryParams . navurl ( fileType . name ( ) . toLowerCase ( ) , 0 , theSearch . query , nav ). toString ( ) ) ;
prop . put ( fileType , "nav-domains_element_" + i + "_url" , QueryParams . navurl ( fileType . name ( ) . toLowerCase ( ) , 0 , theSearch . query , nav , false ). toString ( ) ) ;
prop . put ( "nav-domains_element_" + i + "_count" , count ) ;
prop . put ( "nav-domains_element_" + i + "_nl" , 1 ) ;
i + + ;
@ -184,7 +193,7 @@ public class yacysearchtrailer {
}
String longname = ISO639 . country ( name ) ;
prop . put ( fileType , "nav-languages_element_" + i + "_name" , longname = = null ? name : longname ) ;
prop . put ( fileType , "nav-languages_element_" + i + "_url" , QueryParams . navurl ( fileType . name ( ) . toLowerCase ( ) , 0 , theSearch . query , nav ). toString ( ) ) ;
prop . put ( fileType , "nav-languages_element_" + i + "_url" , QueryParams . navurl ( fileType . name ( ) . toLowerCase ( ) , 0 , theSearch . query , nav , false ). toString ( ) ) ;
prop . put ( "nav-languages_element_" + i + "_count" , count ) ;
prop . put ( "nav-languages_element_" + i + "_nl" , 1 ) ;
i + + ;
@ -225,7 +234,7 @@ public class yacysearchtrailer {
nav = "" ;
}
prop . put ( fileType , "nav-authors_element_" + i + "_name" , name ) ;
prop . put ( fileType , "nav-authors_element_" + i + "_url" , QueryParams . navurl ( fileType . name ( ) . toLowerCase ( ) , 0 , theSearch . query , nav ). toString ( ) ) ;
prop . put ( fileType , "nav-authors_element_" + i + "_url" , QueryParams . navurl ( fileType . name ( ) . toLowerCase ( ) , 0 , theSearch . query , nav , false ). toString ( ) ) ;
prop . put ( "nav-authors_element_" + i + "_count" , count ) ;
prop . put ( "nav-authors_element_" + i + "_nl" , 1 ) ;
i + + ;
@ -270,7 +279,7 @@ public class yacysearchtrailer {
prop . put ( "nav-topics_element_" + i + "_on" , 1 ) ;
prop . put ( fileType , "nav-topics_element_" + i + "_modifier" , name ) ;
prop . put ( fileType , "nav-topics_element_" + i + "_name" , name ) ;
prop . put ( fileType , "nav-topics_element_" + i + "_url" , QueryParams . navurl ( fileType . name ( ) . toLowerCase ( ) , 0 , theSearch . query , name ). toString ( ) ) ;
prop . put ( fileType , "nav-topics_element_" + i + "_url" , QueryParams . navurl ( fileType . name ( ) . toLowerCase ( ) , 0 , theSearch . query , name , false ). toString ( ) ) ;
prop . put ( "nav-topics_element_" + i + "_count" , count ) ;
int fontsize = TOPWORDS_MINSIZE + ( TOPWORDS_MAXSIZE - TOPWORDS_MINSIZE ) * ( count - mincount ) / ( maxcount / mincount ) ;
fontsize = Math . max ( TOPWORDS_MINSIZE , fontsize - ( name . length ( ) - 5 ) ) ;
@ -311,7 +320,7 @@ public class yacysearchtrailer {
nav = "" ;
}
prop . put ( fileType , "nav-protocols_element_" + i + "_name" , name ) ;
prop . put ( fileType , "nav-protocols_element_" + i + "_url" , QueryParams . navurl ( fileType . name ( ) . toLowerCase ( ) , 0 , theSearch . query , nav ). toString ( ) ) ;
prop . put ( fileType , "nav-protocols_element_" + i + "_url" , QueryParams . navurl ( fileType . name ( ) . toLowerCase ( ) , 0 , theSearch . query , nav , false ). toString ( ) ) ;
prop . put ( "nav-protocols_element_" + i + "_count" , count ) ;
prop . put ( "nav-protocols_element_" + i + "_nl" , 1 ) ;
i + + ;
@ -354,7 +363,7 @@ public class yacysearchtrailer {
nav = "" ;
}
prop . put ( fileType , "nav-filetypes_element_" + i + "_name" , name ) ;
prop . put ( fileType , "nav-filetypes_element_" + i + "_url" , QueryParams . navurl ( fileType . name ( ) . toLowerCase ( ) , 0 , theSearch . query , nav ). toString ( ) ) ;
prop . put ( fileType , "nav-filetypes_element_" + i + "_url" , QueryParams . navurl ( fileType . name ( ) . toLowerCase ( ) , 0 , theSearch . query , nav , false ). toString ( ) ) ;
prop . put ( "nav-filetypes_element_" + i + "_count" , count ) ;
prop . put ( "nav-filetypes_element_" + i + "_nl" , 1 ) ;
i + + ;
@ -398,7 +407,7 @@ public class yacysearchtrailer {
nav = "" ;
}
prop . put ( fileType , "nav-vocabulary_" + navvoccount + "_element_" + i + "_name" , name ) ;
prop . put ( fileType , "nav-vocabulary_" + navvoccount + "_element_" + i + "_url" , QueryParams . navurl ( fileType . name ( ) . toLowerCase ( ) , 0 , theSearch . query , nav ). toString ( ) ) ;
prop . put ( fileType , "nav-vocabulary_" + navvoccount + "_element_" + i + "_url" , QueryParams . navurl ( fileType . name ( ) . toLowerCase ( ) , 0 , theSearch . query , nav , false ). toString ( ) ) ;
prop . put ( "nav-vocabulary_" + navvoccount + "_element_" + i + "_count" , count ) ;
prop . put ( "nav-vocabulary_" + navvoccount + "_element_" + i + "_nl" , 1 ) ;
i + + ;