Comments (11)
Instead of adding filters to composed_query method here https://github.com/toptal/chewy/blob/master/lib/chewy/query/criteria.rb#L88 it is better to add them as a separate option to body. If you want to use filter_query request then you should do this explicitly in query()
method.
from chewy.
Here is a sentence from ElasticSearch documentation about facets:
There’s one important distinction to keep in mind. While search queries restrict both the returned documents and facet counts, search filters restrict only returned documents — but not facet counts.
from chewy.
Have you tried global: true
for your facets (http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-facets.html#_scope)?
from chewy.
Global true will run facets on full index, but I want to run them on query, but exclude my filters.
For example, you have a shop catalog. On each category page you want to have a list of top brands for this category. But when user selects one or more brand you still have to show this list, right?
Please look how filters work in Tire. Filters and filtered query are completely different.
Sent from my iPhone
On Apr 22, 2014, at 4:32, Arkadiy Zabazhanov [email protected] wrote:
Have you tried global: true for your facets (http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-facets.html#_scope)?
—
Reply to this email directly or view it on GitHub.
from chewy.
And yet, could you please try global: true with facet_filter? Will it produce the same effect you need?
from chewy.
With facet_filter, I think, yes it will work. But it is completely not right.
When I see 'filter' method in documentation, I believe that it will produce filter, not a filtered query. If I want a filtered query, I will do this in 'query' method.
Sent from my iPhone
On Apr 22, 2014, at 7:39, Arkadiy Zabazhanov [email protected] wrote:
And yet, could you please try global: true with facet_filter? Will it produce the same effect?
—
Reply to this email directly or view it on GitHub.
from chewy.
Sure, but use suggested as workaround, please, since you need the solution ASAP.
Personally I suppose it is fucking stupid when global filter affects query only and query filter affects both query and facets :) So let me please think for a while about this case and I'll find the most suitable approach.
Thanks for turning my attention on this problem.
from chewy.
I will try to prepare PR today.
Sent from my iPhone
On Apr 22, 2014, at 7:54, Arkadiy Zabazhanov [email protected] wrote:
Sure, but use suggested as workaround please since you need the solution ASAP.
Personally I suppose it is fucking stupid when global filter affects query only and query filter affects both query and facets :) So let me please think for a while about this case and I'll find the most suitable approach.Thanks for turning my attention on this problem.
—
Reply to this email directly or view it on GitHub.
from chewy.
You rock!
On Mon, Apr 21, 2014 at 8:58 PM, Igor Alexandrov
[email protected]:
I will try to prepare PR today.
Sent from my iPhone
On Apr 22, 2014, at 7:54, Arkadiy Zabazhanov [email protected]
wrote:Sure, but use suggested as workaround please since you need the solution
ASAP.
Personally I suppose it is fucking stupid when global filter affects
query only and query filter affects both query and facets :) So let me
please think for a while about this case and I'll find the most suitable
approach.Thanks for turning my attention on this problem.
—
Reply to this email directly or view it on GitHub.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/16#issuecomment-41001730
.
from chewy.
It would be awesome, thanks.
from chewy.
Please review PR #17
from chewy.
Related Issues (20)
- Readme comment on Ruby 3 + Rails 6.1
- `Elasticsearch::Transport::Transport::Errors::Found`
- Cleanup journal throws `Yajl::EncodeError: Max nesting depth of 256 exceeded`
- Old indices are not being cleared up after a reset
- Port PR #874 to the 7.0.x branch
- Trying to use Pagy pagination with Chewy, running into autoloading will_paginate gem
- Breaking change at 7.2.4
- I have a question regarding elasticsearch-ruby gem
- Support rails parallel testing
- Warning when upgrading to Rails 7.1
- "#<Chewy::UndefinedUpdateStrategy: Index update strategy is undefined for current context.\n Please wrap your code with `Chewy.strategy(:strategy_name) block.`\n>"} HOT 3
- Update Index Derived from Multiple Associated Models
- Index#order - add missing first/last option
- Deprecated the `zrangebyscore` command
- How to migrate to chewy 7.2 HOT 1
- can not use import to delete missings source objects
- Rake chewy:sync should work for complex "outdated_sync_field" values HOT 2
- Use ENV variable to name index by default HOT 1
- Run some code after indexing has completed
- Status of indexes
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chewy.