public bool TryGetMetadata(IndexQueryBase <BlittableJsonReaderObject> query, out ulong metadataHash, out QueryMetadata metadata)
        {
            metadataHash = 0;
            metadata     = null;

            if (query == null || query.Query == null)
            {
                return(false);
            }

            metadataHash = GetQueryMetadataHash(query);

            metadata = _cache[metadataHash % CacheSize];
            if (metadata == null)
            {
                return(false);
            }

            if (metadata.CacheKey != metadataHash)
            {
                var nextProbe = Hashing.Mix(metadataHash) % CacheSize;
                metadata = _cache[nextProbe];
                if (metadata == null || metadata.CacheKey != metadataHash)
                {
                    return(false);
                }
            }

            // we don't compare the query parameters because they don't matter
            // for the query plan that we use, at any rate, they will either error
            // if the query uses them and it is missing or they are there and will
            // noop because they aren't being used
            return(query.Query == metadata.QueryText);
        }
 public RetrieveDocumentIdsVisitor(TransactionOperationContext serverContext, DocumentsOperationContext context, QueryMetadata metadata, ByteStringContext allocator) : base(metadata.Query.QueryText)
 {
     _query         = metadata.Query;
     _serverContext = serverContext;
     _context       = context;
     _metadata      = metadata;
     _allocator     = allocator;
 }
Example #3
0
 public HasLoadIncludeCounterOrCmpXcngVisitor(QueryMetadata queryMetadata)
 {
     _queryMetadata = queryMetadata;
 }
Example #4
0
 public IndexQueryServerSide(string query, BlittableJsonReaderObject queryParameters = null)
 {
     Query           = Uri.UnescapeDataString(query);
     QueryParameters = queryParameters;
     Metadata        = new QueryMetadata(Query, queryParameters, 0);
 }
Example #5
0
 public IndexQueryServerSide(QueryMetadata metadata)
 {
     Metadata = metadata;
 }
 public RetrieveDocumentIdsVisitor(QueryMetadata metadata, ByteStringContext allocator) : base(metadata.Query.QueryText)
 {
     _query     = metadata.Query;
     _metadata  = metadata;
     _allocator = allocator;
 }
 public FilterKey(QueryMetadata queryMetadata)
 {
     _queryMetadata = queryMetadata;
 }
Example #8
0
 public EsprimaHasLoadOrIncludeVisitor(QueryMetadata queryMetadata)
 {
     _queryMetadata = queryMetadata;
 }