当前位置: 首页>>代码示例>>Java>>正文


Java SearchHandler类代码示例

本文整理汇总了Java中org.apache.solr.handler.component.SearchHandler的典型用法代码示例。如果您正苦于以下问题:Java SearchHandler类的具体用法?Java SearchHandler怎么用?Java SearchHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SearchHandler类属于org.apache.solr.handler.component包,在下文中一共展示了SearchHandler类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: SuggestionService

import org.apache.solr.handler.component.SearchHandler; //导入依赖的package包/类
public SuggestionService(SolrCore solrCore, NamedList args) {

        NamedList l = new NamedList();

        //set spellcheck component if there is one
        if(((ArrayList)args.get("first-components")).contains("spellcheck")) {
            List component = new ArrayList<String>();
            component.add("spellcheck");
            l.add("first-components",component);
            spellcheck_enabled = true;
        }

        if(args.get("defaults") != null && ((NamedList)args.get("defaults")).get(SuggestionRequestParams.SUGGESTION_INTERNAL_LIMIT) != null) {
            internalFacetLimit = (String)((NamedList)args.get("defaults")).get(SuggestionRequestParams.SUGGESTION_INTERNAL_LIMIT);
        }

        this.solrCore = solrCore;
        this.searchHandler = new SearchHandler();
        this.searchHandler.init(l);
        this.searchHandler.inform(solrCore);
    }
 
开发者ID:RBMHTechnology,项目名称:vind,代码行数:22,代码来源:SuggestionService.java

示例2: setUp

import org.apache.solr.handler.component.SearchHandler; //导入依赖的package包/类
@Before
public void setUp() {
	rh1 = mock(SearchHandler.class);
	rh2 = mock(SearchHandler.class);
	rh3 = mock(SearchHandler.class);
	
	cut = new InvisibleQueriesRequestHandler();
	
	qrequest = mock(SolrQueryRequest.class);
	qresponse = mock(SolrQueryResponse.class);
	
	args = new SimpleOrderedMap<>();
	args.add(
			InvisibleQueriesRequestHandler.CHAIN_KEY, 
			SAMPLE_VALID_CHAIN.stream().collect(joining(",")));
	
	params = new ModifiableSolrParams().add(SAMPLE_KEY, SAMPLE_VALUE);
}
 
开发者ID:spaziocodice,项目名称:invisible-queries-request-handler,代码行数:19,代码来源:FacadeRequestHandlerTestCase.java

示例3: handleRequestBody

import org.apache.solr.handler.component.SearchHandler; //导入依赖的package包/类
@Override
public void handleRequestBody(
		final SolrQueryRequest request, 
		final SolrQueryResponse response) throws Exception {
	final SolrParams params = request.getParams();

	response.setAllValues(
		chain.stream()
			.map(refName -> { return requestHandler(request, refName); })
			.filter(SearchHandler.class::isInstance) 
			.map(handler -> { return executeQuery(request, response, params, handler); })
			.filter(qresponse -> howManyFound(qresponse) > 0)
			.findFirst()
			.orElse(emptyResponse(request, response)));
}
 
开发者ID:spaziocodice,项目名称:invisible-queries-request-handler,代码行数:16,代码来源:InvisibleQueriesRequestHandler.java

示例4: setUp

import org.apache.solr.handler.component.SearchHandler; //导入依赖的package包/类
@Before
public void setUp() {
	rh1 = mock(SearchHandler.class);
	rh2 = mock(SearchHandler.class);
	rh3 = mock(SearchHandler.class);

	qrequest = mock(SolrQueryRequest.class);
	qresponse = mock(SolrQueryResponse.class);
	
	args = new SimpleOrderedMap<>();
	args.add(
			InvisibleQueriesRequestHandler.CHAIN_KEY, 
			SAMPLE_VALID_CHAIN.stream().collect(joining(",")));
	
	params = new ModifiableSolrParams().add(SAMPLE_KEY, SAMPLE_VALUE);
	
	core = mock(SolrCore.class);
	when(qrequest.getCore()).thenReturn(core);
	
	when(core.getRequestHandler(REQUEST_HANDLER_1_NAME)).thenReturn(rh1);
	when(core.getRequestHandler(REQUEST_HANDLER_2_NAME)).thenReturn(rh2);
	when(core.getRequestHandler(REQUEST_HANDLER_3_NAME)).thenReturn(rh3);
	
	cut = new InvisibleQueriesRequestHandler();
	
	positiveResult = mock(ResultContext.class);
	docList = mock(DocList.class);
	when(docList.size()).thenReturn(1);
	when(positiveResult.getDocList()).thenReturn(docList);
}
 
开发者ID:spaziocodice,项目名称:invisible-queries-request-handler,代码行数:31,代码来源:InvocationChainTestCase.java

示例5: testCallMBeanInfo

import org.apache.solr.handler.component.SearchHandler; //导入依赖的package包/类
/**
 * Gets a list of everything we can find in the classpath and makes sure it has
 * a name, description, etc...
 */
public void testCallMBeanInfo() throws Exception {
  List<Class> classes = new ArrayList<>();
  classes.addAll(getClassesForPackage(StandardRequestHandler.class.getPackage().getName()));
  classes.addAll(getClassesForPackage(SearchHandler.class.getPackage().getName()));
  classes.addAll(getClassesForPackage(SearchComponent.class.getPackage().getName()));
  classes.addAll(getClassesForPackage(LukeRequestHandler.class.getPackage().getName()));
  classes.addAll(getClassesForPackage(DefaultSolrHighlighter.class.getPackage().getName()));
  classes.addAll(getClassesForPackage(LRUCache.class.getPackage().getName()));
 // System.out.println(classes);
  
  int checked = 0;
  for( Class clazz : classes ) {
    if( SolrInfoMBean.class.isAssignableFrom( clazz ) ) {
      try {
        SolrInfoMBean info = (SolrInfoMBean)clazz.newInstance();
        
        //System.out.println( info.getClass() );
        assertNotNull( info.getName() );
        assertNotNull( info.getDescription() );
        assertNotNull( info.getCategory() );
        
        if( info instanceof LRUCache ) {
          continue;
        }
        
        assertNotNull( info.toString() );
        // increase code coverage...
        assertNotNull( info.getDocs() + "" );
        assertNotNull( info.getStatistics()+"" );
        checked++;
      }
      catch( InstantiationException ex ) {
        // expected...
        //System.out.println( "unable to initalize: "+clazz );
      }
    }
  }
  assertTrue( "there are at least 10 SolrInfoMBean that should be found in the classpath, found " + checked, checked > 10 );
}
 
开发者ID:europeana,项目名称:search,代码行数:44,代码来源:SolrInfoMBeanTest.java

示例6: testCallMBeanInfo

import org.apache.solr.handler.component.SearchHandler; //导入依赖的package包/类
/**
 * Gets a list of everything we can find in the classpath and makes sure it has
 * a name, description, etc...
 */
public void testCallMBeanInfo() throws Exception {
  List<Class> classes = new ArrayList<Class>();
  classes.addAll(getClassesForPackage(StandardRequestHandler.class.getPackage().getName()));
  classes.addAll(getClassesForPackage(SearchHandler.class.getPackage().getName()));
  classes.addAll(getClassesForPackage(SearchComponent.class.getPackage().getName()));
  classes.addAll(getClassesForPackage(LukeRequestHandler.class.getPackage().getName()));
  classes.addAll(getClassesForPackage(DefaultSolrHighlighter.class.getPackage().getName()));
  classes.addAll(getClassesForPackage(LRUCache.class.getPackage().getName()));
 // System.out.println(classes);
  
  int checked = 0;
  for( Class clazz : classes ) {
    if( SolrInfoMBean.class.isAssignableFrom( clazz ) ) {
      try {
        SolrInfoMBean info = (SolrInfoMBean)clazz.newInstance();
        
        //System.out.println( info.getClass() );
        assertNotNull( info.getName() );
        assertNotNull( info.getDescription() );
        assertNotNull( info.getSource() );
        assertNotNull( info.getCategory() );
        
        // Make sure the URL has the classname in it
        //assertTrue(info.getSource(), info.getSource().indexOf(info.getClass().getSimpleName()+".java")>0 );

        if( info instanceof LRUCache ) {
          continue;
        }
        
        assertNotNull( info.toString() );
        // increase code coverage...
        assertNotNull( info.getDocs() + "" );
        assertNotNull( info.getStatistics()+"" );
        checked++;
      }
      catch( InstantiationException ex ) {
        // expected...
        //System.out.println( "unable to initalize: "+clazz );
      }
    }
  }
  assertTrue( "there are at least 10 SolrInfoMBean that should be found in the classpath, found " + checked, checked > 10 );
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:48,代码来源:SolrInfoMBeanTest.java


注:本文中的org.apache.solr.handler.component.SearchHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。