unknown attribute in page_list

Permalink
Hi,

I'm trying to add a search to a page_list containing the attribute value of a page. I'm using the following code:
Loader::model('page_list');
$pl = new PageList(); 
$pl->filterByPageAttribute('my_attribute_handle', $my_value, '=');               
$pages = $pl->getTotal();

The attribute is a selectbox and is searchable. But when executing the code I get the following MySQL error:
mysql error: [1054: Unknown column 'ak_page_attribute' in 'where clause'] in EXECUTE("select p1.cID, pt.ctHandle from Pages p1 left join Pages p2 on (p1.cPointerID = p2.cID) left join PageTypes pt on (pt.ctID = (if (p2.cID is null, p1.ctID, p2.ctID))) left join PagePaths on (PagePaths.cID = p1.cID and PagePaths.ppIsCanonical = 1) left join PageSearchIndex psi on (psi.cID = if(p2.cID is null, p1.cID, p2.cID)) inner join CollectionVersions cv on (cv.cID = if(p2.cID is null, p1.cID, p2.cID) and cvID = (select cvID from CollectionVersions where cvIsApproved = 1 and cID = cv.cID)) inner join Collections c on (c.cID = if(p2.cID is null, p1.cID, p2.cID)) left join CollectionSearchIndexAttributes on (CollectionSearchIndexAttributes.cID = if (p2.cID is null, p1.cID, p2.cID)) where 1=1 and cvIsApproved = '1' and (p1.cIsTemplate = 0 or p2.cIsTemplate = 0) and ak_page_attribute = 'my_attribute_handle' and p1.cIsActive = '1' ")


I also tried this code:
$pl = new PageList(); 
$pl->filterByAttribute('my_attribute_handle', $my_value, '=');               
$pages = $pl->getTotal();

But the result is the same, MySQL can't recognize the column 'my_attribute_handle'.

Can anybody help me? What am I doing wrong here...

Best,

Corretje

DeWebmakers
 
ideasponge replied on at Permalink Reply
ideasponge
try using $pl->controller->filterByAttribute();

EDIT: Forget above. I was thinking this was in reference to the PageList Block.
DeWebmakers replied on at Permalink Best Answer Reply
DeWebmakers
UPDATE:

I manually added the column 'ak_my_attribute_handle' into the table CollecitonSearchIndexAttributes.

This was the solution to my problem.