Sure, but I think you also miss some background about how my queries are
generated. In fact, I have a legacy application which has its own query
format. I am able to map this query format to various search engines,
including Lucene, MG4J and now I am working on ElasticSearch. This
abstract query format is quite old and while I am able to map it to
various search engines, it's logic is sometimes slightly different from
the underlying search engine. This abstract model does have a notion of
filter on a query, and I could use it, but there is another problem :
The second point is about the query format. My abstract query model is
an object model. The input format is parsed into this abstract model. I
had XML until now, and I'm adding a JSON format now. I posted a message
yesterday regarding the ability to use the internal JSON parsers from ES
to be able to reuse the ElasticSearch syntax at some points.
Unfortunately, this is not possible unless using the "extraSource"
parameter of a query. Having those two points in mind, I have a choice
to make :
- add the ability to use the ElasticSearch JSON syntax of a query
filter inside my own JSON query format, but it would require me to write
parsers for the various filters ES supports
- add an "extraSource" section into my custom JSON format where the
user may add a filter. This is the solution I managed to implement.
While it has the restriction of not being able to add a filter on every
subquery, it is perfectly acceptable. However, the problem with this
solution is that the user must use a boolean AND query in order to
emulate a filter at the query level to have the filters "used" by the
facets. Indeed, this is not a filter and suffers performance penalties.
Having a flag allowing the "global filter" to be used by facets would
solve this issue for me. The alternative, reimplementing json parsers
where I wanted the very same format as ElasticSearch to be supported,
I hope this makes it clearer why I think this flag would be useful
Le 07/07/2011 11:38, Clinton Gormley a Ã©crit :
On Thu, 2011-07-07 at 11:29 +0200, CÃ©dric Champeau wrote:
I understand, but in a facetted search, I would expect everything to be
refined, so the facet counts should IMHO change whenever I add a filter.
I still think an option to make have the global filter used by the
facets would be nice
Cedric, I think you missed my point. The top-level filter is there ONLY
for situations where you specifically DON'T want the facets to be bound
by your filter.
So if you use the filtered query, then it will do exactly what you want.