c# - Any idea why this RavenDB query is returning only 6 results? -


we stumped on query in raven , can not figure out wrong life of us. have pretty big index. has transform runs filters out results based on whitelist document contains array of tags.

here index:

public class entries_bywhitelistsearchablefields         : abstractindexcreationtask<entry, entries_bywhitelistsearchablefields.result>     {         public class result         {             public string id { get; set; }             public ienumerable<string> search { get; set; }             public datetimeoffset? lastpublishedatutc { get; set; }             public datetimeoffset lastmodifiedatutc { get; set; }             public datetimeoffset displayatutc { get; set; }             public publishstatus publishstatus { get; set; }             public ienumerable<string> bylineids { get; set; }             public ienumerable<string> tagids { get; set; }             public ienumerable<string> referenceids { get; set; }             public string sourcestreamconfigid { get; set; }             public bool deleted { get; set; }             public ienumerable<string> fullyqualifiedtagids { get; set; }             public datetimeoffset? expireatutc { get; set; }         }          public entries_bywhitelistsearchablefields()         {             this.map = entries => entry in entries                                   let entrysection = entry.tags.firstordefault(tag => tag.schema == "entrysection")                                   entrysection != null                                   select new                                   {                                       id = entry.id,                                       search = entry.tags                                           .select(x => x.label)                                           .concat(new[] { entry.headline }),                                        lastpublishedatutc = entry.lastpublishedatutc,                                       lastmodifiedatutc = entry.lastmodifiedatutc,                                       displayatutc = entry.lastpublishedatutc ?? entry.lastmodifiedatutc,                                       publishstatus = entry.publishstatus,                                       bylineids = entry.bylineids,                                       tagids = entry.tags.select(x => x.id),                                       referenceids = entry.references.select(x => x.id),                                       deleted = entry.deleted,                                       entrysectionid = entrysection.id,                                       fullyqualifiedtagids = entry.tags.select(t => t.schema + "." + t.id),                                       expireatutc = entry.expireatutc                                   };              this.transformresults =                 (database, entries) => entry in entries                                        let whitelist = database.load<whitelist>("whitelistdocid")                                        database.load<entry>(entry.id)                                                      .tags                                                      .select(t => t.schema + "." + t.id)                                                      .intersect(                                                         whitelist.whitelist.select(s => "entrysection." + s))                                                      .any()                                        select entry;             this.index(x => x.search, fieldindexing.analyzed);         }     } 

we have exact same index running, without transform, , works perfectly.

this index seems work, in 1 area, have query:

query = this.session.advanced.lucenequery<entry, entries_bywhitelistsearchablefields>()     .statistics(out stats) .whereequals("deleted", false) .orderby("-displayatutc") .skip(querymodel.pagesize * (querymodel.page - 1)) .take(querymodel.pagesize) .include("bylineids") .include("tags,id") .include("references,id") .select(factory.getentrydashboarditemviewmodel); 

this query works perfect out original index without transform. however, new index, when request pagesize of 100, returns 6 results. when ask 50, returns few. when ask 25, returns 0.

however, line:

.orderby("-displayatutc") 

seems causing problem. when comment out line, works, results not sorted obviously. when put in, same issue few results being returned.

i renamed few things make more sense. please let me know if more information needed.

any or suggestions appreciated.

i assume where in transformresults. note tr happens after paging has happened. feed 100 items, tr filter them out, there no attempt additional results fill rest of page.

in general, tr shouldn't doing filtering.

you should doing in query.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -