4 Commits

Author SHA1 Message Date
Martijn van Groningen
d57d89937f Added scoring support to has_child and has_parent queries.
Added score support to `has_child` and `has_parent` queries. Both queries support a score_type option. The has_child support the same options as the top_children query and the none option which is the default and yields the current behaviour. The has_parent query support the score type options: score and none. The latter is the default and yields the current behaviour.

If the score_type is set to a value other than none then the has_parent query map the matched parent score into the related children documents. The has_child query then map the matched children documents into the related parent document. The score_type on both queries defines how the children documents scores are mapped in the parent documents. Both queries are executed in two phases. First phase collects the parent uid values of matching documents with an aggregated score per parent uid value. In the second phase either child or parent typed documents are emitted as hit that have the same parent uid value as found during the first phase. The score computed in the first phase will be used as score.

Closes #2502
2012-12-24 11:39:43 +01:00
Shay Banon
c22b521800 fix properly handling acceptDocs in filters
our idea is to apply it on the "filtered/constant" level, and not on compound filters, so we won't apply it multiple times. The solution is conservative a bit now, we can further optimize it in the future, for example, not to wrap it when no caching is done within the filter chain
2012-12-06 01:55:16 +01:00
Martijn van Groningen
9c04e6a4f4 Clean up has_parent query code Renamed some exception messages and removed method from builder 2012-09-14 19:06:12 +02:00
Martijn van Groningen
cfe76546f2 Added has_parent query The has_parent query works the same as the has_parent filter, by automatically wrapping the filter with a constant_score. It has the same syntax as the has_parent filter. Closes #2254 2012-09-14 17:34:01 +02:00