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


Java SearchCriteria.size方法代码示例

本文整理汇总了Java中org.jai.search.model.SearchCriteria.size方法的典型用法代码示例。如果您正苦于以下问题:Java SearchCriteria.size方法的具体用法?Java SearchCriteria.size怎么用?Java SearchCriteria.size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jai.search.model.SearchCriteria的用法示例。


在下文中一共展示了SearchCriteria.size方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSearchCriteria

import org.jai.search.model.SearchCriteria; //导入方法依赖的package包/类
private SearchCriteria getSearchCriteria() {
	final ElasticSearchIndexConfig config = ElasticSearchIndexConfig.COM_WEBSITE;
	final SearchCriteria searchCriteria = new SearchCriteria()
			.indices(config.getIndexAliasName());
	searchCriteria.documentTypes(config.getDocumentType());
	searchCriteria.size(50);
	for (final SearchFacetName facet : SearchFacetName.categoryFacets) {
		searchCriteria.facets(facet.getFacetFieldNameAtLevel(2));
	}
	searchCriteria.facets(SearchFacetName.PRODUCT_PRICE_RANGE.getCode());
	searchCriteria.facets(SearchFacetName.PRODUCT_PROPERTY_SIZE.getCode());
	searchCriteria.facets(SearchFacetName.PRODUCT_PROPERTY_COLOR.getCode());
	searchCriteria.facets(SearchFacetName.SPECIFICATION_RESOLUTION
			.getCode());
	searchCriteria.facets(SearchFacetName.SPECIFICATION_MEMORY.getCode());
	return searchCriteria;
}
 
开发者ID:jaibeermalik,项目名称:searchanalytics-bigdata,代码行数:18,代码来源:GenerateSearchAnalyticsDataImpl.java

示例2: paginatedDocumentResults

import org.jai.search.model.SearchCriteria; //导入方法依赖的package包/类
@Test
public void paginatedDocumentResults()
{
    ElasticSearchIndexConfig config = ElasticSearchIndexConfig.COM_WEBSITE;
    SearchCriteria searchCriteria = new SearchCriteria();
    searchCriteria.indices(config.getIndexAliasName());
    searchCriteria.documentTypes(config.getDocumentType());
    
    searchCriteria.size(0);
    ProductSearchResult searchProducts = productQueryService.searchProducts(searchCriteria);
    
    assertEquals(50, searchProducts.getTotalCount());
    assertEquals(0, searchProducts.getProducts().size());
}
 
开发者ID:jaibeermalik,项目名称:elasticsearch-tutorial,代码行数:15,代码来源:ElasticSearchTutPart2Test.java

示例3: searchInMultipleIndexes

import org.jai.search.model.SearchCriteria; //导入方法依赖的package包/类
@Test
public void searchInMultipleIndexes()
{
    ElasticSearchIndexConfig config = ElasticSearchIndexConfig.COM_WEBSITE;
    SearchCriteria searchCriteria = new SearchCriteria();
    searchCriteria.indices(config.getIndexAliasName(), ElasticSearchIndexConfig.NL_WEBSITE.getIndexAliasName());
    searchCriteria.documentTypes(config.getDocumentType());
    
    searchCriteria.size(0);
    ProductSearchResult searchProducts = productQueryService.searchProducts(searchCriteria);
 
    //50 + 50 docs from both indices
    assertEquals(100, searchProducts.getTotalCount());
    assertEquals(0, searchProducts.getProducts().size());
}
 
开发者ID:jaibeermalik,项目名称:elasticsearch-tutorial,代码行数:16,代码来源:ElasticSearchTutPart2Test.java

示例4: boostingDocumentsUsingRescoreOnSoldOut

import org.jai.search.model.SearchCriteria; //导入方法依赖的package包/类
@Test
public void boostingDocumentsUsingRescoreOnSoldOut()
{
    ElasticSearchIndexConfig config = ElasticSearchIndexConfig.COM_WEBSITE;
    SearchCriteria searchCriteria = new SearchCriteria();
    searchCriteria.indices(config.getIndexAliasName());
    searchCriteria.documentTypes(config.getDocumentType());
    searchCriteria.size(50);
    
    ProductSearchResult searchProducts = productQueryService.searchProducts(searchCriteria);
    assertEquals(50, searchProducts.getTotalCount());
    assertEquals(50, searchProducts.getProducts().size());
    
    //By default, even ids are sold out and odd are soldout=false
    searchCriteria.rescoreOnSoldOut(true);

    searchProducts = productQueryService.searchProducts(searchCriteria);
    assertEquals(50, searchProducts.getTotalCount());
    assertEquals(50, searchProducts.getProducts().size());
    
    for (int i = 0; i < 50; i++)
    {
        if (i < 25)
        {
            //not sold out, still available
            assertFalse(searchProducts.getProducts().get(i).isSoldOut());
        }
        else
        {
            //product sold out
            assertTrue(searchProducts.getProducts().get(i).isSoldOut());
        }
    }
}
 
开发者ID:jaibeermalik,项目名称:elasticsearch-tutorial,代码行数:35,代码来源:ElasticSearchTutPart3Test.java

示例5: paginatedDocumentResults

import org.jai.search.model.SearchCriteria; //导入方法依赖的package包/类
@Test
public void paginatedDocumentResults() {
	final ElasticSearchIndexConfig config = ElasticSearchIndexConfig.COM_WEBSITE;
	final SearchCriteria searchCriteria = new SearchCriteria();
	searchCriteria.indices(config.getIndexAliasName());
	searchCriteria.documentTypes(config.getDocumentType());
	searchCriteria.size(0);
	final ProductSearchResult searchProducts = productQueryService
			.searchProducts(searchCriteria);
	assertEquals(50, searchProducts.getTotalCount());
	assertEquals(0, searchProducts.getProducts().size());
}
 
开发者ID:jaibeermalik,项目名称:searchanalytics-bigdata,代码行数:13,代码来源:ElasticSearchTest.java

示例6: searchInMultipleIndexes

import org.jai.search.model.SearchCriteria; //导入方法依赖的package包/类
@Test
public void searchInMultipleIndexes() {
	final ElasticSearchIndexConfig config = ElasticSearchIndexConfig.COM_WEBSITE;
	final SearchCriteria searchCriteria = new SearchCriteria();
	searchCriteria.indices(config.getIndexAliasName(),
			ElasticSearchIndexConfig.NL_WEBSITE.getIndexAliasName());
	searchCriteria.documentTypes(config.getDocumentType());
	searchCriteria.size(0);
	final ProductSearchResult searchProducts = productQueryService
			.searchProducts(searchCriteria);
	// 50 + 50 docs from both indices
	assertEquals(100, searchProducts.getTotalCount());
	assertEquals(0, searchProducts.getProducts().size());
}
 
开发者ID:jaibeermalik,项目名称:searchanalytics-bigdata,代码行数:15,代码来源:ElasticSearchTest.java

示例7: facetingOnHierarchicalDataOnProductCategories

import org.jai.search.model.SearchCriteria; //导入方法依赖的package包/类
@Test
public void facetingOnHierarchicalDataOnProductCategories()
{
    ElasticSearchIndexConfig config = ElasticSearchIndexConfig.COM_WEBSITE;
    SearchCriteria searchCriteria = new SearchCriteria();
    searchCriteria.indices(config.getIndexAliasName());
    searchCriteria.documentTypes(config.getDocumentType());
    
    for (SearchFacetName facet : SearchFacetName.categoryFacets)
    {
        searchCriteria.facets(facet.getFacetFieldNameAtLevel(2));
    }
    searchCriteria.facets(SearchFacetName.PRODUCT_PRICE_RANGE.getCode());
    
    ProductSearchResult searchProducts = productQueryService.searchProducts(searchCriteria);
    
    assertEquals(50, searchProducts.getTotalCount());
    assertEquals(10, searchProducts.getProducts().size());
    assertEquals(5, searchProducts.getFacets().size());
    
    searchCriteria.addSingleSelectFilter(SearchFacetName.SEARCH_FACET_TYPE_PRODUCT_TYPE.getFacetFieldNameAtLevel(3), SampleDataGenerator.MACBOOK);
    searchCriteria.size(50);
    
    searchProducts = productQueryService.searchProducts(searchCriteria);
    
    assertEquals(10, searchProducts.getTotalCount());
    assertEquals(10, searchProducts.getProducts().size());
    assertEquals(5, searchProducts.getFacets().size());
    
    searchCriteria.getSingleSelectFilters().clear();
    searchCriteria.addMultiSelectFilter(SearchFacetName.SEARCH_FACET_TYPE_COLOR.getFacetFieldNameAtLevel(2), SampleDataGenerator.RED);
    searchCriteria.addMultiSelectFilter(SearchFacetName.SEARCH_FACET_TYPE_COLOR.getFacetFieldNameAtLevel(2), SampleDataGenerator.BLUE);
    
    searchProducts = productQueryService.searchProducts(searchCriteria);
    
    assertEquals(10, searchProducts.getTotalCount());
    assertEquals(10, searchProducts.getProducts().size());
    assertEquals(5, searchProducts.getFacets().size());
    
    searchCriteria.getMultiSelectFilters().clear();
    searchCriteria.addSingleSelectFilter(SearchFacetName.PRODUCT_PRICE_RANGE.getCode(), "0 - 10");
    
    searchProducts = productQueryService.searchProducts(searchCriteria);
    
    assertEquals(10, searchProducts.getTotalCount());
    assertEquals(10, searchProducts.getProducts().size());
    assertEquals(5, searchProducts.getFacets().size());
    
    searchCriteria.getSingleSelectFilters().clear();
    searchCriteria.addFiledValueFilter(SearchDocumentFieldName.SOLD_OUT.getFieldName(), true);
    searchCriteria.size(10);
    searchProducts = productQueryService.searchProducts(searchCriteria);
    
    assertEquals(25, searchProducts.getTotalCount());
    assertEquals(10, searchProducts.getProducts().size());
    assertEquals(5, searchProducts.getFacets().size());
    
    
    searchCriteria.getFieldValueFilters().clear();
    searchCriteria.query("title");
    searchProducts = productQueryService.searchProducts(searchCriteria);
    
    assertEquals(50, searchProducts.getTotalCount());
    assertEquals(10, searchProducts.getProducts().size());
    assertEquals(5, searchProducts.getFacets().size());
}
 
开发者ID:jaibeermalik,项目名称:elasticsearch-tutorial,代码行数:67,代码来源:ElasticSearchTutPart4Test.java

示例8: influencingScoreForDocumentsUsingFieldsWeight

import org.jai.search.model.SearchCriteria; //导入方法依赖的package包/类
@Test
public void influencingScoreForDocumentsUsingFieldsWeight()
{
    ElasticSearchIndexConfig config = ElasticSearchIndexConfig.COM_WEBSITE;
    SearchCriteria searchCriteria = new SearchCriteria();
    searchCriteria.indices(config.getIndexAliasName());
    searchCriteria.documentTypes(config.getDocumentType());
    searchCriteria.useBoostingFactor(true);
    searchCriteria.size(50);
    
    ProductSearchResult searchProducts = productQueryService.searchProducts(searchCriteria);
    
    assertEquals(50, searchProducts.getTotalCount());
    assertEquals(50, searchProducts.getProducts().size());
    assertEquals(49, searchProducts.getProducts().get(0).getId().intValue());
    assertEquals(0, searchProducts.getProducts().get(49).getId().intValue());

    int j=0;
    for (Product product : searchProducts.getProducts())
    {
        Product productDoc = productQueryService.getProduct(config, product.getId());
        //Clear out categories, as parent was not set properly..will cause issues in reindexing...ignoring as temp data.
        productDoc.getCategories().clear();
        //set description in reverse order.
        productDoc.setDescription("Description " + j);
        indexProductData.indexProduct(config, productDoc);
        j++;
    }
    
    refreshSearchServer();
    
    //query for string 10.
    //title field weight TITLE:  (float) 0.5) DESCRIPTION : (float) 0.15)
    searchCriteria.query("10");
    searchProducts = productQueryService.searchProducts(searchCriteria);
    
    assertEquals(2, searchProducts.getTotalCount());
    assertEquals(2, searchProducts.getProducts().size());
    assertEquals(10, searchProducts.getProducts().get(0).getId().intValue());
    assertEquals("Title 10", searchProducts.getProducts().get(0).getTitle());
    assertEquals("Description 10", productQueryService.getProduct(config, searchProducts.getProducts().get(1).getId()).getDescription());
}
 
开发者ID:jaibeermalik,项目名称:elasticsearch-tutorial,代码行数:43,代码来源:ElasticSearchTutPart3Test.java


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