本文整理匯總了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);
}