Skip to content
Permalink
Browse files

Merge pull request #1246 from ezsystems/impl-24319-indexable-isbn

Implement EZP-24319: Indexable ISBN field type
  • Loading branch information...
pspanja committed May 4, 2015
2 parents c8493b5 + e3337a7 commit 27f4aaec39229d23de0716bda6ed12d4a259985f
@@ -18,7 +18,7 @@
* @group integration
* @group field-type
*/
class ISBNIntegrationTest extends BaseIntegrationTest
class ISBNIntegrationTest extends SearchBaseIntegrationTest
{
/**
* Get name of tested field type
@@ -343,4 +343,14 @@ public function providerForTestIsNotEmptyValue()
),
);
}
protected function getValidSearchValueOne()
{
return "9780099067504";
}
protected function getValidSearchValueTwo()
{
return "9780380448340";
}
}
@@ -0,0 +1,65 @@
<?php
/**
* This file is part of the eZ Publish Kernel package
*
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
* @version //autogentag//
*/
namespace eZ\Publish\Core\FieldType\ISBN;
use eZ\Publish\SPI\Persistence\Content\Field;
use eZ\Publish\SPI\FieldType\Indexable;
use eZ\Publish\SPI\Search;
/**
* Indexable definition for ISBN field type
*/
class SearchField implements Indexable
{
/**
* Get index data for field for search backend
*
* @param Field $field
*
* @return \eZ\Publish\SPI\Search\Field[]
*/
public function getIndexData( Field $field )
{
return array(
new Search\Field(
'value',
$field->value->data,
new Search\FieldType\StringField()
),
);
}
/**
* Get index field types for search backend
*
* @return \eZ\Publish\SPI\Search\FieldType[]
*/
public function getIndexDefinition()
{
return array(
'value' => new Search\FieldType\StringField(),
);
}
/**
* Get name of the default field to be used for query and sort.
*
* As field types can index multiple fields (see MapLocation field type's
* implementation of this interface), this method is used to define default
* field for query and sort. Default field is typically used by Field
* criterion and sort clause.
*
* @return string
*/
public function getDefaultField()
{
return "value";
}
}
@@ -1,6 +1,7 @@
parameters:
ezpublish.fieldType.indexable.ezstring.class: eZ\Publish\Core\FieldType\TextLine\SearchField
ezpublish.fieldType.indexable.eztext.class: eZ\Publish\Core\FieldType\TextBlock\SearchField
ezpublish.fieldType.indexable.ezisbn.class: eZ\Publish\Core\FieldType\ISBN\SearchField
ezpublish.fieldType.indexable.ezboolean.class: eZ\Publish\Core\FieldType\Checkbox\SearchField
ezpublish.fieldType.indexable.ezdatetime.class: eZ\Publish\Core\FieldType\DateAndTime\SearchField
ezpublish.fieldType.indexable.ezemail.class: eZ\Publish\Core\FieldType\EmailAddress\SearchField
@@ -93,9 +94,8 @@ services:
tags:
- {name: ezpublish.fieldType.indexable, alias: ezrichtext}

# TODO: define proper type
ezpublish.fieldType.indexable.ezisbn:
class: %ezpublish.fieldType.indexable.ezstring.class%
class: %ezpublish.fieldType.indexable.ezisbn.class%
tags:
- {name: ezpublish.fieldType.indexable, alias: ezisbn}

0 comments on commit 27f4aae

Please sign in to comment.
You can’t perform that action at this time.