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

Programmatically add refinement #23

Closed
mauxtin opened this issue Oct 8, 2018 · 2 comments
Closed

Programmatically add refinement #23

mauxtin opened this issue Oct 8, 2018 · 2 comments

Comments

@mauxtin
Copy link

mauxtin commented Oct 8, 2018

I am looking for a way of adding a refinement programmatically.

My use case is the following:
When someone visits /category/category1 I get a category_id.
I want to only display the entries that have this specific category_id. (which is an attribute on my index entries of course).

So when I set my host, index and type (using this.setHost, this.setIndex and this.setType) I also want to set a refinement (e.g. this.setRefinement('category_id', category_id) ) and only display those.

How would I go for achieving that?

@mauxtin
Copy link
Author

mauxtin commented Oct 9, 2018

Seems to be duplicated of #22

@mauxtin
Copy link
Author

mauxtin commented Oct 13, 2018

FWIW The solution I came up with was this (of course after setting host port index etc. )

    this.addInstruction({
      fun: 'andFilter',
      args: ['term', 'category.id', this.category.id]
    })

@mauxtin mauxtin closed this as completed Oct 13, 2018
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