/** * @since 2.5 * * @param ValueDescription $description * * @return boolean */ public function canApplyFulltextSearchMatchCondition(ValueDescription $description) { if (!$this->isEnabled() || $description->getProperty() === null) { return false; } if ($this->searchTable->isExemptedProperty($description->getProperty())) { return false; } $matchableText = $this->getMatchableTextFromDescription($description); $comparator = $description->getComparator(); if ($matchableText && ($comparator === SMW_CMP_LIKE || $comparator === SMW_CMP_NLKE)) { return $this->hasMinTokenLength(str_replace('*', '', $matchableText)); } return false; }
/** * @since 2.5 * * @param ValueDescription $description * * @return boolean */ public function canApplyFulltextSearchMatchCondition(ValueDescription $description) { if (!$this->isEnabled() || $description->getProperty() === null) { return false; } if ($this->searchTable->isExemptedProperty($description->getProperty())) { return false; } $matchableText = $this->getMatchableTextFromDescription($description); $comparator = $description->getComparator(); if ($matchableText && ($comparator === SMW_CMP_LIKE || $comparator === SMW_CMP_NLKE)) { // http://dev.mysql.com/doc/refman/5.7/en/fulltext-boolean.html // innodb_ft_min_token_size and innodb_ft_max_token_size are used // for InnoDB search indexes. ft_min_word_len and ft_max_word_len // are used for MyISAM search indexes // Don't count any wildcard return $this->hasMinTokenLength(str_replace('*', '', $matchableText)); } return false; }
/** * @dataProvider valueDescriptionProvider */ public function testCommonMethods($dataItem, $property, $comparator, $expected) { $instance = new ValueDescription($dataItem, $property, $comparator); $this->assertEquals($expected['comparator'], $instance->getComparator()); $this->assertEquals($expected['dataItem'], $instance->getDataItem()); $this->assertEquals($expected['property'], $instance->getProperty()); $this->assertEquals($expected['queryString'], $instance->getQueryString()); $this->assertEquals($expected['queryStringAsValue'], $instance->getQueryString(true)); $this->assertEquals($expected['isSingleton'], $instance->isSingleton()); $this->assertEquals(array(), $instance->getPrintRequests()); $this->assertEquals(1, $instance->getSize()); $this->assertEquals(0, $instance->getDepth()); $this->assertEquals(0, $instance->getQueryFeatures()); }