本文整理汇总了Java中org.apache.solr.common.SolrDocument.setField方法的典型用法代码示例。如果您正苦于以下问题:Java SolrDocument.setField方法的具体用法?Java SolrDocument.setField怎么用?Java SolrDocument.setField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.solr.common.SolrDocument
的用法示例。
在下文中一共展示了SolrDocument.setField方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGetDocument
import org.apache.solr.common.SolrDocument; //导入方法依赖的package包/类
/**
* Test of getDocument method, of class SolrDocumentServiceImpl.
*/
@Test
public void testGetDocument() {
final SolrQuery solrQuery = new SolrQuery("query");
final SolrDocument resultDocument = new SolrDocument();
resultDocument.setField("id", "documentId");
final SolrDocumentList resultList = new SolrDocumentList();
resultList.add(resultDocument);
context.checking(new Expectations() {
{
oneOf(queryFactory).createDocumentQuery("documentId");
will(returnValue(solrQuery));
oneOf(dao).getDocuments(solrQuery);
will(returnValue(resultList));
}
});
final SolrDocument result = instance.getDocument("documentId");
assertEquals(resultDocument, result);
assertEquals("documentId", result.getFieldValue("id"));
}
示例2: setUp
import org.apache.solr.common.SolrDocument; //导入方法依赖的package包/类
@Before
public void setUp() {
tester = new WicketTester(application);
document = new SolrDocument();
document.setField(FacetConstants.FIELD_ID, "documentId");
params = new PageParameters();
params.set(VloWebAppParameters.DOCUMENT_ID, "documentId");
}
示例3: testSearchFormPanel
import org.apache.solr.common.SolrDocument; //导入方法依赖的package包/类
@Test
public void testSearchFormPanel() {
final SolrDocument document = new SolrDocument();
document.setField(FacetConstants.FIELD_SELF_LINK, "hdl:1234/selflink");
final ContentSearchFormPanel panel = new ContentSearchFormPanel("panel", Model.of(document), Model.of("http://cqlEndPoint/"));
tester.startComponentInPage(panel);
// form action should be aggregator search page
tester.assertContains("action=\"http://fcs.org/aggregator\"");
// json hidden input should have the CQL endpoint and document handle, and should be encoded into entities
tester.assertContains(Pattern.quote("name=\"x-aggregation-context\" value=\"{"http://cqlEndPoint/": ["hdl:1234/selflink"]}\""));
}
示例4: setUp
import org.apache.solr.common.SolrDocument; //导入方法依赖的package包/类
@Before
public void setUp() {
expected = new SolrDocument();
expected.setField(FacetConstants.FIELD_ID, "id");
service = context.mock(SolrDocumentService.class);
}