Пример #1
0
		public void IndexAndSearchMustBeOk()
		{
			JObject o = new JObject();
			o["title"] = "la belle qui dors";
			o["editor"] = "arnaud";
			IScore score = Context.Current.Instance.ScoreController.FromJson(o.ToString());
			Context.Current.Instance.IndexController.AddScore(score, new Result()).Wait();
			ScoreQuery q = new ScoreQuery()
			{
				Offset = 0,
				Max = 10,
				Title = "belle",
				Editor = "arnaud"
			};
			SearchResult<IScoreSearchResult> result = Context.Current.Instance.IndexController.SearchScore(q, new Result<SearchResult<IScoreSearchResult>>()).Wait();
		}
Пример #2
0
		public Yield SearchScore(DreamContext aContext, DreamMessage aRequest, Result<DreamMessage> aResponse)
		{
			theLogger.Info("SearchScore");
			ScoreQuery query = new ScoreQuery
			                   	{
			                   		Composer = aContext.GetParam("composer", null),
			                   		Editor = aContext.GetParam("editor", null),
			                   		Title = aContext.GetParam("title", null),
			                   		TitleWild = aContext.GetParam("titleWild", null),
			                   		Verses = aContext.GetParam("verses", null),
			                   		Music = aContext.GetParam("music", null),
			                   		IsMaster = aContext.GetParam("isMaster", null),
			                   		MasterId = aContext.GetParam("masterId", null),
			                   		Offset = aContext.GetParam("offset", 0),
			                   		Max = aContext.GetParam("max", 20)
			                   	};
			Result<SearchResult<IScoreSearchResult>> result = new Result<SearchResult<IScoreSearchResult>>();
			yield return Context.Current.Instance.IndexController.SearchScore(query, result);
			aResponse.Return(DreamMessage.Ok(MimeType.JSON, Context.Current.Instance.IndexController.ToJson(result.Value)));
		}