Right,
So I've installed the module, and the multifield module, launched jetty/solr from the module directory and added the DataObject::add_extension('Entry', 'SolrIndexable');
have this data object:
class Entry extends DataObject {
public static $db = array(
'FirstName' => 'Text',
'LastName' => 'Text',
'Caption' => 'Text',
'Location' => 'Text'
);
public static $has_one = array(
'Photo' => 'Image',
'CategoryPage' => 'CategoryPage',
'ThumbPage' => 'ThumbPage'
);
static $searchable_fields = array(
'FirstName' => array(
'title' => 'FirstName',
'filter' => 'PartialMatchfilter'),
'LastName' => array(
'title' => 'LastName',
'filter' => 'PartialMatchfilter'),
'Caption' => array(
'title' => 'Phototitle',
'filter' => 'PartialMatchfilter')
);
static $summary_fields = array(
'FirstName',
'LastName',
'Caption',
'Location',
'CategoryPage.Title',
'ThumbPage.Title',
'ImageTitle'
);
function ImageTitle() {
$pt = $this->Photo()->Name;
return $pt;
}
/* public function getCustomSearchContext() {
$fields = $this->scaffoldSearchFields(array(
'restrictFields' => array('FirstName', 'LastName', 'Caption', 'Category')
));
$filters = array(
'FirstName' => new PartialMatchFilter('FirstName'),
'LastName' => new PartialMatchFilter('LastName'),
'Caption' => new PartialMatchFilter('Caption')
);
return new SearchContext(
$this->class,
$fields,
$filters
);
} */
public function getCMSFields_forPopup() {
return new FieldSet(
new TextField('FirstName'),
new TextField('LastName'),
new TextField('Caption'),
new TextField('Location'),
/* new DropdownField('CategoryPageID', 'Choose a category', DataObject::get('CategoryPage')->map("ID", "Title", "Please Select")), */
new ImageField('Photo')
);
}
public function SplitList($val=3) {
return ($this->iteratorPos + 1) % $val == 0;
}
function goBack() {
$src = $this->ThumbPageID;
$button = SiteTree::get_by_id('ThumbPage', $src);
return $button;
}
}
but still only pages are indexed.
I've added a debug::show at line 143 of SolrSearchService in the index function
public function index($dataObject, $stage=null) {
$document = new Apache_Solr_Document();
$fieldsToIndex = array();
Debug::show($dataObject);
and this returns all my Page types but no data object.
Would there be a better place to put this?