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


PHP Search::addFilter方法代码示例

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


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

示例1: testFiter

 public function testFiter()
 {
     $s = new Search('');
     $s->addFilter((new Filter('tags', '=', 'Women'))->addOr('tags', '=', 'dress pants'));
     $r = $this->engine->search($s);
     $this->assertEquals($r->results->hits[0]->id, 'f346904e7dcd43c521bff2e6dcfae21a');
     $this->assertEquals($r->results->hits[1]->id, 'c05ef333b5dbd9f31123a65221762395');
 }
开发者ID:blackbirdtech,项目名称:merlin-php,代码行数:8,代码来源:MerlinTest.php

示例2: Search

$r = $engine->search((new Search('red dress'))->addField('id')->addField('title'));
printResults($r);
//Get all fields including debug fields
$r = $engine->search((new Search('red dress'))->addField('[debug]'));
printResults($r);
//Filter by price < 100
$r = $engine->search((new Search('red dress'))->addFilter(new Filter('price', '<', 100)));
printResults($r);
//A query where we want red dresses in size '2P' or in size '4R' and
$s = new Search('red dress');
$s->addFilter((new Filter('sizes', '=', '2P', '2p2r'))->addOr('sizes', '=', '4R'));
$r = $engine->search($s);
printResults($r);
//A query where we want red dresses under $100 and the top 5 brands returned as facets
$s = new Search('red dress');
$s->addFilter(new Filter('price', '<', 100));
$s->addFacet(new EnumFacet('brand', 5));
$r = $engine->search($s);
printResults($r);
//A query where we want red dresses and the range of prices returned
$s = new Search('red dress');
$s->addFacet(new RangeFacet('price'));
$r = $engine->search($s);
printResults($r);
//A query where we want red dresses and a histogram of their
$s = new Search('red dress');
$s->addFacet(new HistFacet('price', 0, 500, 100));
$r = $engine->search($s);
printResults($r);
//A search with multiple keyed facets on the 'brand' field
$s = new Search('red dress');
开发者ID:blackbirdtech,项目名称:merlin-php,代码行数:31,代码来源:searchExamples.php

示例3: get_additional_team_bio_page_info

	protected function get_additional_team_bio_page_info( $team )
	{
		/* code to get testimonials ordered by date new to old */
 		loadModel( "/entities/testimonials/EntityTestimonial" );
		//$testimonials = EntityTestimonial::GetEntityTeamTestimonialsWithSubTestimonials( $team  );
		$testimonials = EntityTestimonial::GetEntityTestimonialsOrderByOrder( $team );
		$testimonial_dicts = array();
		foreach( $testimonials as $testimonial ) {
			$testimonial_dicts[] = $testimonial->getAsDictionary();
		}
		
		/* get team listings */
		loadModel( "/search/Search" );
		$properties = array();
		$search = new Search();
		$search->addTerm( 'realtor', $team->rebrand_code );
		$search->addOrderBy( 'list_price', false);
		$props = $search->run( 0, 7 );
		$tmp_properties = Property::GetPropertiesFromIdArray($props, PropertyLoadLevel::IDX_SUMMARY, true);
		foreach( $props as $prop ) {
			try{
				$property = $tmp_properties[$prop];
				// add open house
				// $property->open_house = $property->getAllDates( true );
				$temp_pic = $property->get_first_pic();
				if ( is_object( $temp_pic ) ){
					$property->photo = $temp_pic->getUrl();
				} else {
					$property->photo = false;
				}
				$properties[] = $property;
			}
			catch( Exception $e ) {}
		}
		unset($tmp_properties);
		

		/* get team sold listings */
		$sold_properties = array();
		$sold_search = new Search();
		$sold_search->addTerm( 'buyer_seller', $team->rebrand_code );
		$sold_search->addFilter( SearchFilter::SOLD );
		$sold_search->addOrderBy( 'list_price', false);
		$sold_props = $sold_search->run( 0, 3);
		//set idx view to the sold table to get the sold prop info
		IDX::Set_IDX_View_Name( IDX::SOLD );
		$tmp_properties = Property::GetPropertiesFromIdArray($sold_props, PropertyLoadLevel::IDX_SUMMARY, true);

		foreach( $sold_props as $sold_prop ) {
			try{
				$property = $tmp_properties[$sold_prop];
				$temp_pic = $property->get_first_pic();
				if ( is_object( $temp_pic ) ){
					$property->photo = $temp_pic->getUrl();
				} else {
					$property->photo = false;
				}
				$sold_properties[] = $property;
			}
			catch( Exception $e ) {}
		}
		unset($tmp_properties);

		//reset back to normal idx view
		IDX::Set_IDX_View_Name( IDX::MATERIALIZED );

		$tpl_args = array(
			'testimonials' => $testimonial_dicts,
			'properties' => $properties,
			'sold_properties' => $sold_properties,
		);
		return $tpl_args;
 	}
开发者ID:nicholasbooj,项目名称:Enterprise_Boilerplate,代码行数:73,代码来源:ctrl_Realtor.action.php

示例4: testFilterEscapeChars

 public function testFilterEscapeChars()
 {
     $s = new Search('');
     $s->addFilter((new Filter('Color', '=', 'Red!\\,|', null, Filter::TYPE_CNF))->addAnd('Color', '!=', 'Blue'));
     $this->assertEquals('q=&filter=' . urlencode('exp=Color:Red\\!\\\\\\,\\|,Color:!Blue/type=cnf'), $s->getUrlString());
 }
开发者ID:blackbirdtech,项目名称:merlin-php,代码行数:6,代码来源:SearchTest.php


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