@@ -10,7 +10,7 @@ namespace Nest
1010 public class QueryDescriptor < T > : QueryContainer where T : class
1111 {
1212
13-
13+ //TODO remove all the shortcuts into descriptors except for .Term(s)()
1414
1515 public QueryDescriptor ( )
1616 {
@@ -291,6 +291,7 @@ public QueryContainer Indices(Action<IndicesQueryDescriptor<T>> selector)
291291
292292 return this . New ( query , q => q . Indices = query ) ;
293293 }
294+
294295 /// <summary>
295296 /// Matches documents with fields that have terms within a certain range. The type of the Lucene query depends
296297 /// on the field type, for string fields, the TermRangeQuery, while for number/date fields, the query is
@@ -303,6 +304,7 @@ public QueryContainer Range(Action<RangeQueryDescriptor<T>> selector)
303304
304305 return this . New ( query , q => q . Range = query ) ;
305306 }
307+
306308 /// <summary>
307309 /// Fuzzy like this query find documents that are “like” provided text by running it against one or more fields.
308310 /// </summary>
@@ -444,6 +446,7 @@ public QueryContainer HasChild<K>(Action<HasChildQueryDescriptor<K>> selector) w
444446
445447 return this . New ( query , q => q . HasChild = query ) ;
446448 }
449+
447450 /// <summary>
448451 /// The has_child query works the same as the has_child filter, by automatically wrapping the filter with a
449452 /// constant_score.
@@ -456,6 +459,7 @@ public QueryContainer HasParent<K>(Action<HasParentQueryDescriptor<K>> selector)
456459
457460 return this . New ( query , q => q . HasParent = query ) ;
458461 }
462+
459463 /// <summary>
460464 /// The top_children query runs the child query with an estimated hits size, and out of the hit docs, aggregates
461465 /// it into parent docs. If there aren’t enough parent docs matching the requested from/size search request,
@@ -469,6 +473,7 @@ public QueryContainer TopChildren<K>(Action<TopChildrenQueryDescriptor<K>> selec
469473
470474 return this . New ( query , q => q . TopChildren = query ) ;
471475 }
476+
472477 /// <summary>
473478 /// A query that applies a filter to the results of another query. This query maps to Lucene FilteredQuery.
474479 /// </summary>
@@ -500,6 +505,7 @@ public QueryContainer Dismax(Action<DisMaxQueryDescriptor<T>> selector)
500505
501506 return this . New ( query , q => q . DisMax = query ) ;
502507 }
508+
503509 /// <summary>
504510 /// A query that wraps a filter or another query and simply returns a constant score equal to the query boost
505511 /// for every document in the filter. Maps to Lucene ConstantScoreQuery.
@@ -511,6 +517,7 @@ public QueryContainer ConstantScore(Action<ConstantScoreQueryDescriptor<T>> sele
511517
512518 return this . New ( query , q => q . ConstantScore = query ) ;
513519 }
520+
514521 /// <summary>
515522 /// custom_boost_factor query allows to wrap another query and multiply its score by the provided boost_factor.
516523 /// This can sometimes be desired since boost value set on specific queries gets normalized, while this
@@ -524,6 +531,7 @@ public QueryContainer CustomBoostFactor(Action<CustomBoostFactorQueryDescriptor<
524531
525532 return this . New ( query , q => q . CustomBoostFactor = query ) ;
526533 }
534+
527535 /// <summary>
528536 /// custom_score query allows to wrap another query and customize the scoring of it optionally with a
529537 /// computation derived from other field values in the doc (numeric ones) using script expression
@@ -536,6 +544,7 @@ public QueryContainer CustomScore(Action<CustomScoreQueryDescriptor<T>> customSc
536544
537545 return this . New ( query , q => q . CustomScore = query ) ;
538546 }
547+
539548 /// <summary>
540549 /// custom_score query allows to wrap another query and customize the scoring of it optionally with a
541550 /// computation derived from other field values in the doc (numeric ones) using script or boost expression
@@ -547,6 +556,7 @@ public QueryContainer CustomFiltersScore(Action<CustomFiltersScoreQueryDescripto
547556
548557 return this . New ( query , q => q . CustomFiltersScore = query ) ;
549558 }
559+
550560 /// <summary>
551561 /// A query that matches documents matching boolean combinations of other queries. The bool query maps to
552562 /// Lucene BooleanQuery.
@@ -583,11 +593,13 @@ public QueryContainer Boosting(Action<BoostingQueryDescriptor<T>> boostingQuery)
583593 /// boosting into account, the norms_field needs to be provided in order to explicitly specify which
584594 /// field the boosting will be done on (Note, this will result in slower execution time).
585595 /// </param>
586- public QueryContainer MatchAll ( double ? Boost = null , string NormField = null )
596+ public QueryContainer MatchAll ( double ? Boost = null , string NormField = null , string Name = null )
587597 {
598+ //TODO introduce a proper optional query descriptor
588599 var query = new MatchAllQuery ( ) { NormField = NormField } ;
589600 if ( Boost . HasValue )
590601 query . Boost = Boost . Value ;
602+ query . Name = Name ;
591603
592604 return this . New ( query , q => q . MatchAllQuery = query ) ;
593605 }
@@ -605,6 +617,7 @@ public QueryContainer Term<K>(Expression<Func<T, K>> fieldDescriptor, K value, d
605617 t . Boost ( Boost . Value ) ;
606618 } ) ;
607619 }
620+
608621 /// <summary>
609622 /// Matches documents that have fields that contain a term (not analyzed).
610623 /// The term query maps to Lucene TermQuery.
@@ -618,6 +631,7 @@ public QueryContainer Term(Expression<Func<T, object>> fieldDescriptor, object v
618631 t . Boost ( Boost . Value ) ;
619632 } ) ;
620633 }
634+
621635 /// <summary>
622636 /// Matches documents that have fields that contain a term (not analyzed).
623637 /// The term query maps to Lucene TermQuery.
@@ -631,6 +645,7 @@ public QueryContainer Term(string field, object value, double? Boost = null)
631645 t . Boost ( Boost . Value ) ;
632646 } ) ;
633647 }
648+
634649 /// <summary>
635650 /// Matches documents that have fields that contain a term (not analyzed).
636651 /// The term query maps to Lucene TermQuery.
@@ -641,6 +656,7 @@ public QueryContainer Term(Action<TermQueryDescriptor<T>> termSelector)
641656 termSelector ( termQuery ) ;
642657 return this . New ( termQuery , q => q . Term = termQuery ) ;
643658 }
659+
644660 /// <summary>
645661 /// Matches documents that have fields matching a wildcard expression (not analyzed).
646662 /// Supported wildcards are *, which matches any character sequence (including the empty one), and ?,
@@ -657,6 +673,7 @@ public QueryContainer Wildcard(Expression<Func<T, object>> fieldDescriptor, stri
657673 if ( Rewrite . HasValue ) t . Rewrite ( Rewrite . Value ) ;
658674 } ) ;
659675 }
676+
660677 /// <summary>
661678 /// Matches documents that have fields matching a wildcard expression (not analyzed).
662679 /// Supported wildcards are *, which matches any character sequence (including the empty one), and ?,
@@ -687,6 +704,7 @@ public QueryContainer Wildcard(Action<WildcardQueryDescriptor<T>> wildcardSelect
687704 wildcardSelector ( wildcardQuery ) ;
688705 return this . New ( wildcardQuery , q => q . Wildcard = wildcardQuery ) ;
689706 }
707+
690708 /// <summary>
691709 /// Matches documents that have fields containing terms with a specified prefix (not analyzed).
692710 /// The prefix query maps to Lucene PrefixQuery.
@@ -725,6 +743,7 @@ public QueryContainer Prefix(Action<PrefixQueryDescriptor<T>> prefixSelector)
725743 prefixSelector ( prefixQuery ) ;
726744 return this . New ( prefixQuery , q => q . Prefix = prefixQuery ) ;
727745 }
746+
728747 /// <summary>
729748 /// Filters documents that only have the provided ids. Note, this filter does not require
730749 /// the _id field to be indexed since it works using the _uid field.
@@ -758,6 +777,17 @@ public QueryContainer Ids(IEnumerable<string> types, IEnumerable<string> values)
758777 return this . New ( ids , q => q . Ids = ids ) ;
759778 }
760779
780+ /// <summary>
781+ /// Filters documents that only have the provided ids.
782+ /// Note, this filter does not require the _id field to be indexed since
783+ /// it works using the _uid field.
784+ /// </summary>
785+ public QueryContainer Ids ( Func < IdsQueryProperDescriptor , IdsQueryProperDescriptor > selector )
786+ {
787+ var ids = selector ( new IdsQueryProperDescriptor ( ) ) ;
788+ return this . New ( ids , c => c . Ids = ids ) ;
789+ }
790+
761791 /// <summary>
762792 /// Matches spans containing a term. The span term query maps to Lucene SpanTermQuery.
763793 /// </summary>
@@ -791,6 +821,7 @@ public QueryContainer SpanTerm(Action<SpanTermQueryDescriptor<T>> spanTermSelect
791821 spanTermSelector ( spanTerm ) ;
792822 return this . New ( spanTerm , q => q . SpanTerm = spanTerm ) ;
793823 }
824+
794825 /// <summary>
795826 /// Matches spans near the beginning of a field. The span first query maps to Lucene SpanFirstQuery.
796827 /// </summary>
0 commit comments