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


Java NameUsageSearchResult类代码示例

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


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

示例1: fullTextSearch

import org.gbif.api.model.checklistbank.search.NameUsageSearchResult; //导入依赖的package包/类
public List<NameUsageSearchResult> fullTextSearch(NameUsageSearchRequest searchRequest) {
List<NameUsageSearchResult> result = Lists.newArrayList();
SearchResponse<NameUsageSearchResult, NameUsageSearchParameter> response = null;

boolean isInitial = true;
do {
    response = search(searchRequest);
    if(response == null)
	break;
    result.addAll(response.getResults());
    int limit = response.getLimit();
    if (isInitial) {
	limit = Pager.getMaxLimit(response);
	isInitial = false;
    }
    searchRequest.setLimit(limit);
    searchRequest.setOffset(response.getOffset() + limit);
}
while(!Pager.isEndOfRecords(response));

return result;
   }
 
开发者ID:nomencurator,项目名称:taxonaut,代码行数:23,代码来源:SpeciesAPIClient.java

示例2: NubNameUsage

import org.gbif.api.model.checklistbank.search.NameUsageSearchResult; //导入依赖的package包/类
public NubNameUsage(org.gbif.api.model.checklistbank.NameUsage scientificNameUsage,
			  NameUsageSearchResult nameUsageSearchResult,
			  NameUsageSuggestResult nameUsageSuggestResult) {
super();
if(isConformal(scientificNameUsage, nameUsageSearchResult, nameUsageSuggestResult)) {
    if(scientificNameUsage != null) {
	setScientificName(scientificNameUsage);
    }
    if(nameUsageSearchResult != null) {
	setNameUsageSearchResult(nameUsageSearchResult);
    }
    if(nameUsageSuggestResult != null){
	setNameUsageSuggestResult(nameUsageSuggestResult);
    }
}
   }
 
开发者ID:nomencurator,项目名称:taxonaut,代码行数:17,代码来源:NubNameUsage.java

示例3: createNubNameUsage

import org.gbif.api.model.checklistbank.search.NameUsageSearchResult; //导入依赖的package包/类
protected NubNameUsage createNubNameUsage(NameUsageSearchResult result)
throws IOException
   {
NubNameUsage nameUsage = getObject(result.getKey());
if (nameUsage == null) {
    nameUsage = new NubNameUsage(result);
    nubNameUsages.put(result.getKey(), nameUsage);
    UUID datasetKey = result.getDatasetKey();
    if(datasetKey != null) {
	nameUsage.setDataset(getDataset(datasetKey));
    }
    datasetKey = result.getConstituentKey();
    if(datasetKey != null) {
	nameUsage.setConstituentDataset(getDataset(datasetKey));
    }
}
return nameUsage;
   }
 
开发者ID:nomencurator,项目名称:taxonaut,代码行数:19,代码来源:NubExchanger.java

示例4: assertSearch

import org.gbif.api.model.checklistbank.search.NameUsageSearchResult; //导入依赖的package包/类
private SearchResponse<NameUsageSearchResult, NameUsageSearchParameter> assertSearch(NameUsageSearchRequest searchRequest, boolean useFacets,
                                                                                     Long expectedCount, String expectedFacetCounts) {

  // query
  SearchResponse<NameUsageSearchResult, NameUsageSearchParameter> response = wsClient.search(searchRequest);

  // assert
  if (expectedCount != null) {
    assertEquals(expectedCount, response.getCount());
  }

  if (useFacets && expectedFacetCounts != null) {
    assertEquals(1, response.getFacets().size());
    assertEquals(expectedFacetCounts, response.getFacets().get(0).getCounts().size());
  }
  if (!useFacets) {
    Assert.assertTrue(response.getFacets().isEmpty());
  }

  for (NameUsageSearchResult u : response.getResults()) {
    assertNotNull(u);
    assertEquals(NameUsageSearchResult.class, u.getClass());
  }

  return response;
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:27,代码来源:NameUsageSearchWsClientIT.java

示例5: testList

import org.gbif.api.model.checklistbank.search.NameUsageSearchResult; //导入依赖的package包/类
@Test
@PrepareForTest(WebResource.Builder.class)
public void testList() {
  WebResource.Builder builder = PowerMockito.mock(WebResource.Builder.class);
  NameUsageSearchRequest searchRequest = new NameUsageSearchRequest(DEFAULT_PARAM_OFFSET, DEFAULT_PARAM_LIMIT);
  searchRequest.setQ("*");
  when(resource.type(any(String.class))).thenReturn(builder);
  when(resource.accept(any(String.class))).thenReturn(builder);
  // there is no path, it uses the default URL /checklist
  SearchResponse<NameUsageSearchResult, NameUsageSearchParameter> defaultResponse =
    new SearchResponse<NameUsageSearchResult, NameUsageSearchParameter>(DEFAULT_PARAM_OFFSET, DEFAULT_PARAM_LIMIT);
  when(builder.get(any(GenericType.class))).thenReturn(defaultResponse);
  when(resource.get(any(GenericType.class))).thenReturn(defaultResponse);

  SearchResponse<NameUsageSearchResult, NameUsageSearchParameter> response = client.search(searchRequest);
  Assert.assertNotNull(response);
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:18,代码来源:NameUsageSearchWsClientTest.java

示例6: buildSearch

import org.gbif.api.model.checklistbank.search.NameUsageSearchResult; //导入依赖的package包/类
/**
 * Builds a SearchResponse instance using the current builder state.
 *
 * @return a new instance of a SearchResponse.
 */
public SearchResponse<NameUsageSearchResult, NameUsageSearchParameter> buildSearch(NameUsageSearchRequest searchRequest, QueryResponse response) {
  // Create response
  SearchResponse<NameUsageSearchResult, NameUsageSearchParameter> resp = new SearchResponse<NameUsageSearchResult, NameUsageSearchParameter>(searchRequest);
  resp.setCount(response.getResults().getNumFound());
  resp.setLimit(response.getResults().size());

  // Main result documents
  SolrDocumentList docs = response.getResults();
  for (SolrDocument doc : docs) {
    resp.getResults().add(converter.toSearchUsage(doc, searchRequest.isExtended()));
  }

  // add facets
  setFacets(resp, response);

  // add highlighting
  setHighlighting(resp, response, searchRequest);
  return resp;
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:25,代码来源:ResponseBuilder.java

示例7: setFacets

import org.gbif.api.model.checklistbank.search.NameUsageSearchResult; //导入依赖的package包/类
/**
 * Helper method that takes Solr response and extracts the facets results.
 * The facets are converted to a list of Facets understood by the search API.
 * The result of this method can be a empty list.
 *
 * @param queryResponse that contains the facets information returned by Solr
 * @return the List of facets retrieved from the Solr response
 */
private void setFacets(SearchResponse<NameUsageSearchResult, NameUsageSearchParameter> response, final QueryResponse queryResponse) {
  List<Facet<NameUsageSearchParameter>> facets = Lists.newArrayList();
  if (queryResponse.getFacetFields() != null) {
    List<FacetField> facetFields =  queryResponse.getFacetFields();
    for (final FacetField facetField : facetFields) {
      NameUsageSearchParameter facetParam = SolrMapping.FACET_MAPPING.inverse().get(facetField.getName());
      Facet<NameUsageSearchParameter> facet = new Facet<NameUsageSearchParameter>(facetParam);

      List<Facet.Count> counts = Lists.newArrayList();
      if (facetField.getValues() != null) {
        for (final FacetField.Count count : facetField.getValues()) {
          String value = SolrMapping.interpretSolrValue(facetParam, count.getName());
          counts.add(new Facet.Count(value, count.getCount()));
        }
      }
      facet.setCounts(counts);
      facets.add(facet);
    }
  }
  response.setFacets(facets);
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:30,代码来源:ResponseBuilder.java

示例8: getDatasetTitle

import org.gbif.api.model.checklistbank.search.NameUsageSearchResult; //导入依赖的package包/类
public String getDatasetTitle()
   {
NameUsage<? extends NubNameUsage> n = getNameUsage();
if(n != this) {
    if(n instanceof NubNameUsage) {
	return ((NubNameUsage)n).getDatasetTitle();
    }
}

if(dataset != null) {
    return dataset.getTitle();
}
else {
    UUID datasetKey = null;
    org.gbif.api.model.checklistbank.NameUsage scientificNameUsage = getScientificNameUsage();
    if(scientificNameUsage != null) {
	datasetKey = scientificNameUsage.getDatasetKey();
    }
    if(datasetKey == null) {
	NameUsageSearchResult nameUsageSearchResult = getNameUsageSearchResult();
	if(nameUsageSearchResult != null) {
	    datasetKey = nameUsageSearchResult.getDatasetKey();
	}
    }
    if(datasetKey != null) {
	return datasetKey.toString();
    }
}

return null;
   }
 
开发者ID:nomencurator,项目名称:taxonaut,代码行数:32,代码来源:NubNameUsage.java

示例9: isConformal

import org.gbif.api.model.checklistbank.search.NameUsageSearchResult; //导入依赖的package包/类
protected boolean isConformal(org.gbif.api.model.checklistbank.NameUsage scientificNameUsage,
			  NameUsageSearchResult nameUsageSearchResult,
			  NameUsageSuggestResult nameUsageSuggestResult)
   {
return isConformal(nameUsageSearchResult, nameUsageSuggestResult) &&
    isConformal(scientificNameUsage, nameUsageSuggestResult) &&
    isConformal(scientificNameUsage, nameUsageSearchResult);
   }
 
开发者ID:nomencurator,项目名称:taxonaut,代码行数:9,代码来源:NubNameUsage.java

示例10: setNameUsageSearchResult

import org.gbif.api.model.checklistbank.search.NameUsageSearchResult; //导入依赖的package包/类
public boolean setNameUsageSearchResult(NameUsageSearchResult nameUsageSearchResult)
   {
NameUsage<? extends NubNameUsage> n = getNameUsage();
if(n != this) {
    if(n instanceof NubNameUsage) {
	return ((NubNameUsage)n).setNameUsageSearchResult(nameUsageSearchResult);
    }
}

if(this.nameUsageSearchResult == nameUsageSearchResult ||
   (this.nameUsageSearchResult != null && nameUsageSearchResult != null &&
    this.nameUsageSearchResult.equals(nameUsageSearchResult)) ||
   !isConformal(this.scientificNameUsage, nameUsageSearchResult, this.nameUsageSuggestResult)
   ){
    return false;
}

clearNameUsageSearchResult();
if(scientificNameUsage == null && nameUsageSearchResult != null) {
    setRank(RankMap.get(RankMap.get(nameUsageSearchResult.getRank().getMarker())));
    if(nameUsageSearchResult.getNumDescendants() == 0) {
	setLowerNameUsages(null);
	this.lowerNameUsages = Collections.emptyList();
    }
}

this.nameUsageSearchResult = nameUsageSearchResult;

return true;
   }
 
开发者ID:nomencurator,项目名称:taxonaut,代码行数:31,代码来源:NubNameUsage.java

示例11: getFullTextNameUsages

import org.gbif.api.model.checklistbank.search.NameUsageSearchResult; //导入依赖的package包/类
protected Collection<NubNameUsage> getFullTextNameUsages(String query, Rank rank, boolean includeSynonyms, boolean includeVernaculars, Locale locale)
throws IOException
   {
String[] literals = splitQuery(query);
if (literals == null)
    return null;

List<NubNameUsage> nameUsages = null;
for (String literal : literals) {
    List<NameUsageSearchResult> results = dataSource.fullTextSearch(literal, RankMap.get(rank), 
								    null, null, null, null, null, null, null, null, null, null, null);
    if(results != null) {
	nameUsages = new ArrayList<NubNameUsage>(results.size());
	for (NameUsageSearchResult result : results) {
	    NubNameUsage nameUsage = getObject(result.getKey());
	    if(nameUsage == null) {
		nameUsage = createNubNameUsage(result);
		//nameUsage = new NubNameUsage(result);
		//nubNameUsages.put(result.getKey(), nameUsage);
	    }
	    //else
	    nameUsage.setNameUsageSearchResult(result);
	    nameUsages.add(nameUsage);
	}
	results.clear();
    }
}
return nameUsages;
   }
 
开发者ID:nomencurator,项目名称:taxonaut,代码行数:30,代码来源:NubExchanger.java

示例12: setUp

import org.gbif.api.model.checklistbank.search.NameUsageSearchResult; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
  mockNameUsageService = mock(NameUsageService.class);
  mockVernacularNameService = mock(VernacularNameService.class);
  mockTypeSpecimenService = mock(TypeSpecimenService.class);
  mockSpeciesProfileService = mock(SpeciesProfileService.class);
  mockReferenceService = mock(ReferenceService.class);
  mockImageService = mock(MultimediaService.class);
  mockDescriptionService = mock(DescriptionService.class);
  mockDistributionService = mock(DistributionService.class);
  mockIdentifierService = mock(IdentifierService.class);
  mockSearchService = mock(NameUsageSearchService.class);
  mockUsageCountMapper = mock(UsageCountMapper.class);

  searchResponse = new SearchResponse<NameUsageSearchResult, NameUsageSearchParameter>(0, 20);
  searchResponse.setCount(1000L);

  resource = new SpeciesResource(mockNameUsageService, mockVernacularNameService, mockTypeSpecimenService,
    mockSpeciesProfileService, mockReferenceService, mockImageService, mockDescriptionService,
    mockDistributionService, mockIdentifierService, mockSearchService, mockUsageCountMapper);

  locale = Locale.US;
  nameUsage = new NameUsage();
  nameUsage.setKey(NAME_USAGE_KEY);

  page = new PagingRequest(0, 1);
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:28,代码来源:SpeciesResourceTest.java

示例13: searchHighlightTest

import org.gbif.api.model.checklistbank.search.NameUsageSearchResult; //导入依赖的package包/类
@Test
public void searchHighlightTest() {
  NameUsageSearchRequest searchRequest = new NameUsageSearchRequest(DEFAULT_PARAM_OFFSET, DEFAULT_PARAM_LIMIT);
  searchRequest.setQ("puma");
  searchRequest.setHighlight(true);
  SearchResponse<NameUsageSearchResult, NameUsageSearchParameter> response = wsClient.search(searchRequest);
  assertNotNull(response);
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:9,代码来源:NameUsageSearchWsClientIT.java

示例14: searchTest

import org.gbif.api.model.checklistbank.search.NameUsageSearchResult; //导入依赖的package包/类
@Test
public void searchTest() {
  NameUsageSearchRequest searchRequest = new NameUsageSearchRequest(DEFAULT_PARAM_OFFSET, DEFAULT_PARAM_LIMIT);
  searchRequest.setQ("puma");
  searchRequest.addFacets(NameUsageSearchParameter.DATASET_KEY);
  searchRequest.addParameter(NameUsageSearchParameter.DATASET_KEY, Constants.NUB_DATASET_KEY.toString());
  searchRequest.setMultiSelectFacets(true);
  SearchResponse<NameUsageSearchResult, NameUsageSearchParameter> response = wsClient.search(searchRequest);
  assertNotNull(response);
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:11,代码来源:NameUsageSearchWsClientIT.java

示例15: searchTestWithNubKey

import org.gbif.api.model.checklistbank.search.NameUsageSearchResult; //导入依赖的package包/类
@Test
public void searchTestWithNubKey() {
  NameUsageSearchRequest searchRequest = new NameUsageSearchRequest(DEFAULT_PARAM_OFFSET, DEFAULT_PARAM_LIMIT);
  searchRequest.setQ("oenanthe");
  searchRequest.addParameter(NameUsageSearchParameter.HIGHERTAXON_KEY, "3184223");
  searchRequest.addFacets(NameUsageSearchParameter.DATASET_KEY);
  searchRequest.addParameter(NameUsageSearchParameter.DATASET_KEY, Constants.NUB_DATASET_KEY.toString());
  SearchResponse<NameUsageSearchResult, NameUsageSearchParameter> response = wsClient.search(searchRequest);
  assertNotNull(response);
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:11,代码来源:NameUsageSearchWsClientIT.java


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