protected override void AcceptInternal(MinResultOperator resultOperator, LuceneQueryModel model) { model.ResetSorts(); model.AddSort(model.SelectClause, OrderingDirection.Asc); model.MaxResults = 1; model.Aggregate = true; }
protected override void AcceptInternal(SkipResultOperator skip, LuceneQueryModel model) { var additionalSkip = skip.GetConstantCount(); model.SkipResults += additionalSkip; if (model.MaxResults != int.MaxValue) { model.MaxResults -= additionalSkip; } }
public async Task <IActionResult> Content([FromQuery] LuceneQueryModel queryModel) { if (!await _authorizationService.AuthorizeAsync(User, Permissions.QueryLuceneApi)) { return(this.ChallengeOrForbid("Api")); } var result = await LuceneQueryApiAsync(queryModel, returnContentItems : true); return(new ObjectResult(result)); }
public async Task <IActionResult> DocumentsPost(LuceneQueryModel queryModel) { if (!await _authorizationService.AuthorizeAsync(User, Permissions.QueryLuceneApi)) { return(this.ChallengeOrForbid("Api")); } var result = await LuceneQueryApiAsync(queryModel); return(new ObjectResult(result)); }
private Task <Queries.IQueryResults> LuceneQueryApiAsync(LuceneQueryModel queryModel, bool returnContentItems = false) { var luceneQuery = new LuceneQuery { Index = queryModel.IndexName, Template = queryModel.Query, ReturnContentItems = returnContentItems }; var queryParameters = queryModel.Parameters != null? JsonConvert.DeserializeObject <Dictionary <string, object> >(queryModel.Parameters) : new Dictionary <string, object>(); var result = _luceneQuerySource.ExecuteQueryAsync(luceneQuery, queryParameters); return(result); }
internal QueryModelTranslator(Context context, IFieldMappingInfoProvider fieldMappingInfoProvider) { this.context = context; this.fieldMappingInfoProvider = fieldMappingInfoProvider; this.model = new LuceneQueryModel(fieldMappingInfoProvider); }
protected override void AcceptInternal(TakeResultOperator take, LuceneQueryModel model) { model.MaxResults = Math.Min(take.GetConstantCount(), model.MaxResults); }
protected override void AcceptInternal(LastResultOperator resultOperator, LuceneQueryModel model) { model.Last = true; }
protected override void AcceptInternal(FirstResultOperator resultOperator, LuceneQueryModel model) { model.MaxResults = 1; }
public abstract void Accept(ResultOperatorBase resultOperator, LuceneQueryModel model);
internal QueryModelTranslator(IFieldMappingInfoProvider fieldMappingInfoProvider, Context context) { this.fieldMappingInfoProvider = fieldMappingInfoProvider; this.context = context; this.model = new LuceneQueryModel(fieldMappingInfoProvider); }
protected override object Execute(LuceneQueryModel luceneQueryModel, TopFieldDocs hits) { return(hits.TotalHits - luceneQueryModel.SkipResults > 0); }
protected abstract object Execute(LuceneQueryModel luceneQueryModel, TopFieldDocs hits);
public T Execute <T>(LuceneQueryModel luceneQueryModel, TopFieldDocs hits) { return((T)Convert.ChangeType(Execute(luceneQueryModel, hits), typeof(T))); }
public abstract void Accept(ResultOperatorBase resultOperator, LuceneQueryModel model);