Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EZP-26804: Search with section id list filter #201

Merged
merged 1 commit into from Dec 22, 2017

Conversation

blankse
Copy link
Contributor

@blankse blankse commented Dec 21, 2016

Copy link
Member

@bdunogier bdunogier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides the few remarks, looks good to me.

I'd also simplify the commit message to remove "eZFind", as the commit is part of the ezfind repo.

@@ -1530,6 +1531,53 @@ protected function getContentClassFilterQuery( $contentClassIdent )
}

/**
* Generate section query filter.
*
* @param mixed eZSection id or list of ids.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@param int|int[] $sectionIdent eZSection id or list of ids.

* @param mixed eZSection id or list of ids.
*
* @return string Section query filter. Returns null if invalid
* $sectionIdent is provided.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to align the second line with string.


return implode( ' OR ', $sectionQueryParts );
}
elseif ( (int)$sectionIdent . '' == $sectionIdent . '' )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd handle this case first as it is the most common. Then I'd get rid of the else, as we return inside the if.

@blankse blankse changed the title EZP-26804 - eZ Find search with section id list filter EZP-26804: Search with section id list filter Jan 25, 2017
@blankse
Copy link
Contributor Author

blankse commented Jan 25, 2017

@bdunogier I take your remarks into account :)

{
return eZSolr::getMetaFieldName( 'section_id' ) . ':' . $sectionIdent;
}
elseif ( is_array( $sectionIdent ) )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need the else, since you return in the if above.

@blankse
Copy link
Contributor Author

blankse commented Feb 2, 2017

@bdunogier I removed the else

@blankse
Copy link
Contributor Author

blankse commented Apr 13, 2017

Ping @bdunogier

foreach ( $sectionIdent as $sectionID )
{
$sectionID = trim( $sectionID );
if ( empty( $sectionID ) )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is empty array value something we need to support? it could just go straight to error, or?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can remove it

return null;
}

if ( is_numeric( $sectionIdent ) )
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be better to use ctype_digit()

@gggeek
Copy link
Collaborator

gggeek commented Dec 6, 2017

Beside remark, +1

@blankse
Copy link
Contributor Author

blankse commented Dec 7, 2017

@andrerom @gggeek I changed it.

@andrerom andrerom merged commit 9d3334d into ezsystems:master Dec 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants