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


Java SolrTemplate类代码示例

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


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

示例1: testDefaultDocumentDecorator

import org.springframework.data.solr.core.SolrTemplate; //导入依赖的package包/类
/**
 * Insure that a non-null document decorator is provided by the abstract impl\
 */
@Test
@SuppressWarnings({"unchecked", "rawtypes"})
public void testDefaultDocumentDecorator() {
    Function documentMapper = mock(Function.class);
    SolrCrudRepository repository = mock(SolrCrudRepository.class);
    SolrTemplate template = mock(SolrTemplate.class);

    AbstractEventTupleIndexer underTest = new AbstractEventTupleIndexer(documentMapper, repository, template) {
        @Override
        public void preIndex(EventDiscoTuple tuple) {

        }

        @Override
        public void postIndex(Object solrDocument) {

        }
    };

    assertNotNull(underTest.documentDecorator);
}
 
开发者ID:rmap-project,项目名称:rmap,代码行数:25,代码来源:AbstractEventTupleIndexerTest.java

示例2: getTargetRepository

import org.springframework.data.solr.core.SolrTemplate; //导入依赖的package包/类
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
protected Object getTargetRepository(RepositoryMetadata metadata) {

	SolrOperations operations = this.solrOperations;
	if (factory != null) {
		SolrTemplate template = new SolrTemplate(factory);
		template.setSolrCore(SolrServerUtils.resolveSolrCoreName(metadata.getDomainType()));
		addSchemaCreationFeaturesIfEnabled(template);
		template.afterPropertiesSet();
		operations = template;
	}

	SimpleSolrRepository repository = new SimpleSolrRepository(getEntityInformation(metadata.getDomainType()),
			operations);
	repository.setEntityClass(metadata.getDomainType());

	this.templateHolder.add(metadata.getDomainType(), operations);
	return repository;
}
 
开发者ID:ramaava,项目名称:spring-data-solr,代码行数:21,代码来源:SolrRepositoryFactory.java

示例3: registerUriConverter

import org.springframework.data.solr.core.SolrTemplate; //导入依赖的package包/类
private static void registerUriConverter(SolrTemplate solrTemplate) {
    DefaultQueryParser queryParser = new DefaultQueryParser();
    queryParser.registerConverter(new Converter<URI, String>() {
        @Nullable
        @Override
        public String convert(URI uri) {
            if (uri == null) {
                return null;
            }
            String converted = uri.toString().replaceAll(":", "\\\\:");
            return converted;
        }
    });
    solrTemplate.registerQueryParser(Query.class, queryParser);
}
 
开发者ID:rmap-project,项目名称:rmap,代码行数:16,代码来源:SimpleSolrIT.java

示例4: DiscosIndexer

import org.springframework.data.solr.core.SolrTemplate; //导入依赖的package包/类
/**
 * {@inheritDoc}
 *
 * @param documentMapper {@inheritDoc}
 * @param repository {@inheritDoc}
 * @param template {@inheritDoc}
 */
public DiscosIndexer(Function<EventDiscoTuple, DiscoSolrDocument> documentMapper,
                     SolrCrudRepository<DiscoSolrDocument, Long> repository, SolrTemplate template) {
    super(documentMapper, repository, template);

    // There *is* a Spring Bean definition for DiscoSolrOperations that *ought* to be injected by this constructor.
    // However, DiscoSolrOperations test coverage is nill.  Testing of DiscoSolrOperations is indirectly
    // accomplished by the DiscosIndexerTest, whereby expectations on the SolrTemplate are verified.
    // If DiscoSolrOperations is injected into this constructor, then the DiscoIndexerTest would need to be
    // re-written with expectations against DiscoSolrOperations, not the SolrTemplate.  And DiscoSolrOperations
    // would need its own test.  All good things, but due to lack of time, leaving this as a TODO.
    this.discoOperations = new DiscosSolrOperations(template, CORE_NAME);
}
 
开发者ID:rmap-project,项目名称:rmap,代码行数:20,代码来源:DiscosIndexer.java

示例5: SolrRepositoryFactory

import org.springframework.data.solr.core.SolrTemplate; //导入依赖的package包/类
public SolrRepositoryFactory(SolrOperations solrOperations) {
	Assert.notNull(solrOperations);

	if (solrOperations instanceof SolrTemplate) {
		addSchemaCreationFeaturesIfEnabled((SolrTemplate) solrOperations);
	}

	this.solrOperations = solrOperations;
	this.entityInformationCreator = new SolrEntityInformationCreatorImpl(solrOperations.getConverter()
			.getMappingContext());
}
 
开发者ID:ramaava,项目名称:spring-data-solr,代码行数:12,代码来源:SolrRepositoryFactory.java

示例6: createTemplate

import org.springframework.data.solr.core.SolrTemplate; //导入依赖的package包/类
private SolrTemplate createTemplate(SolrServer solrServer) {

		SolrTemplate template = new SolrTemplate(solrServer);
		addSchemaCreationFeaturesIfEnabled(template);
		template.afterPropertiesSet();
		return template;
	}
 
开发者ID:ramaava,项目名称:spring-data-solr,代码行数:8,代码来源:SolrRepositoryFactory.java

示例7: setUp

import org.springframework.data.solr.core.SolrTemplate; //导入依赖的package包/类
@Before
public void setUp() {
	repository = new ExampleSolrBeanRepository();
	SolrTemplate template = new SolrTemplate(solrServer, null);
	template.afterPropertiesSet();
	repository.setSolrOperations(template);
}
 
开发者ID:ramaava,项目名称:spring-data-solr,代码行数:8,代码来源:ITestSimpleSolrRepository.java

示例8: testGetRepositoryOfUnmanageableType

import org.springframework.data.solr.core.SolrTemplate; //导入依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testGetRepositoryOfUnmanageableType() {

	SolrTemplate template = new SolrTemplate(new HttpSolrServer("http://solrserver:8983/solr"), null);
	template.afterPropertiesSet();
	new SolrRepositoryFactory(template).getRepository(UnmanagedEntityRepository.class);
}
 
开发者ID:ramaava,项目名称:spring-data-solr,代码行数:8,代码来源:SolrRepositoryFactoryTests.java

示例9: bootstrapsRepository

import org.springframework.data.solr.core.SolrTemplate; //导入依赖的package包/类
/**
 * @see DATASOLR-72
 */
@SuppressWarnings("rawtypes")
@Test
public void bootstrapsRepository() throws Exception {

	Assume.assumeTrue(repository instanceof Advised);

	SimpleSolrRepository simpleSolrRepository = (SimpleSolrRepository) ((Advised) repository).getTargetSource()
			.getTarget();
	SolrTemplate solrTemplate = (SolrTemplate) simpleSolrRepository.getSolrOperations();
	solrTemplate.getSchemaCreationFeatures().contains(Feature.CREATE_MISSING_FIELDS);

	Assert.assertThat(repository, is(notNullValue()));
}
 
开发者ID:ramaava,项目名称:spring-data-solr,代码行数:17,代码来源:ITestEnableSolrRepositoriesWithSchemaCreationSupport.java

示例10: createSolrTemplate

import org.springframework.data.solr.core.SolrTemplate; //导入依赖的package包/类
@Produces
public SolrOperations createSolrTemplate() throws IOException, ParserConfigurationException, SAXException {

	EmbeddedSolrServerFactory factory = new EmbeddedSolrServerFactory(ResourceUtils.getURL(
			"classpath:org/springframework/data/solr").getPath());

	SolrTemplate template = new SolrTemplate(factory);
	template.afterPropertiesSet();
	return template;
}
 
开发者ID:ramaava,项目名称:spring-data-solr,代码行数:11,代码来源:SolrTemplateProducer.java

示例11: init

import org.springframework.data.solr.core.SolrTemplate; //导入依赖的package包/类
public ExternalServerWithManagedSchemaRule init() {
	SolrTemplate template = new SolrTemplate(new HttpSolrServer(baseUrl));

	try {
		String schemaName = template.getSchemaName("collection1");
		if (!schemaName.equalsIgnoreCase("example-schemaless")) {
			errMsg = "Expected to run in schemaless mode";
		}
	} catch (Exception e) {
		errMsg = "Solr Server not running - " + e.getMessage();
	}

	return this;
}
 
开发者ID:ramaava,项目名称:spring-data-solr,代码行数:15,代码来源:ExternalServerWithManagedSchemaRule.java

示例12: setUp

import org.springframework.data.solr.core.SolrTemplate; //导入依赖的package包/类
@Before
public void setUp() {
	this.template = new SolrTemplate(new HttpSolrServer("http://localhost:8983/solr"));
	template.setSchemaCreationFeatures(Collections.singletonList(Feature.CREATE_MISSING_FIELDS));
	template.afterPropertiesSet();

	template.delete(new SimpleQuery("*:*"));
	template.commit();
}
 
开发者ID:ramaava,项目名称:spring-data-solr,代码行数:10,代码来源:ITestSolrSchemaCreation.java

示例13: solrTemplate

import org.springframework.data.solr.core.SolrTemplate; //导入依赖的package包/类
public @Bean SolrTemplate solrTemplate() {
	return new SolrTemplate(new HttpSolrClient("http://localhost:8983/solr"), "collection1");
}
 
开发者ID:Just-Fun,项目名称:spring-data-examples,代码行数:4,代码来源:SolrTestConfiguration.java

示例14: setSolrTemplate

import org.springframework.data.solr.core.SolrTemplate; //导入依赖的package包/类
@Inject
public void setSolrTemplate(SolrTemplate solrTemplate) {
    this.solrTemplate = solrTemplate;
}
 
开发者ID:LIBCAS,项目名称:ARCLib,代码行数:5,代码来源:SolrStore.java

示例15: solrTemplate

import org.springframework.data.solr.core.SolrTemplate; //导入依赖的package包/类
@Bean
public SolrTemplate solrTemplate(SolrClient client) throws Exception {
    return new SolrTemplate(client);
}
 
开发者ID:LIBCAS,项目名称:ARCLib,代码行数:5,代码来源:SolrConfig.java


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