On the client side (3.5.4), I've got this query:
var query = this.Query<VCPCoverageIndex.Projection, VCPCoverageIndex>();
if (filter != null && filter.CIds != null)
// string[] CIds {
query = query.Where(x =>
x.CId.In(filter.CIds));
}
if (filter != null && filter.Batches != null)
// string[] Batches {
query = query.Where(x =>
x.Batch.In(filter.Batches));
}
return query;
Which becomes:
( @in<CId>:(VC
\-97) ) AND ( @in<Batch>:(2017
\-11
\-23T21
\:34
\:35.6870721Z) )
Zero results are given. If I change the query like that:
( ( @in<CId>: (VC-97) ) AND @in<Batch>: (2017-11-23T21:34:35.6870721Z) )
it works... It looks like the client library is escaping dashes and semicolons within the parentheses and RavenDB doesn't like that.
Am I doing something wrong?
The index:
public sealed class VCPCoverageIndex : AbstractIndexCreationTask<VST, VCPCoverageIndex.Projection>
{
public VCPCoverageIndex()
{
this.Map = docs =>
from d in docs
select new Projection
{
CId = d.CId,
ProviderId = d.ProviderId,
Batch = d.DateCreatedUtc.ToString("o"),
StatusPending = d.Status == VSTStatus.Pending ? 1 : 0,
StatusDone = d.Status == VSTStatus.Done ? 1 : 0,
StatusFailed = d.Status == VSTStatus.Failed ? 1 : 0,
};
this.Reduce = results =>
from r in results
group r by new
{
r.CId,
r.ProviderId,
r.Batch,
} into g
select new Projection
{
CId = g.Key.CId,
ProviderId = g.Key.ProviderId,
Batch = g.Key.Batch,
StatusPending = g.Sum(x => x.StatusPending),
StatusDone = g.Sum(x => x.StatusDone),
StatusFailed = g.Sum(x => x.StatusFailed),
};
}
public class Projection
{
public string CId { get; set; }
public string ProviderId { get; set; }
public string Batch { get; set; }
public int StatusPending { get; set; }
public int StatusDone { get; set; }
public int StatusFailed { get; set; }
}