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

ExactMatch operator does not seem to work with properties containing multiple references #3

Open
Duske opened this issue Nov 6, 2014 · 2 comments
Assignees

Comments

@Duske
Copy link

Duske commented Nov 6, 2014

Use Case:
There's a nodetype "project" which has a property "categories" of type references. On the category page, i want to list all projects which have the current category in their reference property.
Eel:

    ${Search.query(site).nodeType('My.Vendor:Project').exactMatch('category', node).execute()}

This works when there's only one category attached, if a 'project' has more than one category it will be not listed. Is there any possibility to check if the node is in the references list? Something like:

    ${Search.query(site).nodeType('My.Vendor:Project').isInProperty('category', node).execute()}
@Duske
Copy link
Author

Duske commented Nov 10, 2014

I solved my problem by extending \Flowpack\SimpleSearch\ContentRepositoryAdaptor\Search\SqLiteQueryBuilder and adding the following function:

/**
     * adds an like query for references.
     *
     * @param $propertyName
     * @param $propertyValue
     * @return QueryBuilder
     */
    public function isInReferences($propertyName, $propertyValue) {
        $this->where[] = "(" . $propertyName . " LIKE '%" . $propertyValue->getIdentifier() . "%')";
        return $this;
    }

@Duske Duske changed the title ExactMatch operator does not seem to work with properties containing multiple items ExactMatch operator does not seem to work with properties containing multiple references Dec 9, 2014
@kitsunet
Copy link
Member

Thanks, will check how we want to deal with this in the API and implement.

@kitsunet kitsunet self-assigned this Dec 29, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants