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

How to work with multiple facets in one query #190

Open
Jon78 opened this issue May 5, 2020 · 1 comment
Open

How to work with multiple facets in one query #190

Jon78 opened this issue May 5, 2020 · 1 comment

Comments

@Jon78
Copy link

Jon78 commented May 5, 2020

Hi,

We're trying to build a single query with multiple facets, like the one in this example.

The query should look like this:

"SELECT * FROM table FACET facet_1 FACET facet_2"

The builder seems to accept an array, but this is made into a single facet:

"SELECT * FROM table FACET facet_1, facet_2"

When we loop through the facets array and add the individual facets we get this:

"SELECT * FROM table FACET facet_1, facet_2 FACET facet_1, facet_2"

Which is somewhat closer to what we want, but still does not produce anything useful.

How do we make this happen?

@Jon78
Copy link
Author

Jon78 commented May 6, 2020

Managed to get it working by

  • cloning the Facet-object with every facet like so
use Facades\Foolz\SphinxQL\Facet;
...
            foreach($facets as $facet) {
                $query->facet(clone Facet::facet($facet));
            }

and

  • resetting the facets-array in src/Facet.php:118

Since this will probably break functionality I'll fork this repo and work from there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant