Пример #1
0
        public override Document Get(Lucene.Net.Documents.Document input, float score, IState state)
        {
            using (RetrieverScope?.Start())
            {
                if (TryGetKey(input, state, out string id) == false)
                {
                    throw new InvalidOperationException($"Could not extract '{Constants.Documents.Indexing.Fields.DocumentIdFieldName}' from index.");
                }

                if (FieldsToFetch.IsProjection)
                {
                    return(GetProjection(input, score, id, state));
                }

                using (_storageScope = _storageScope?.Start() ?? RetrieverScope?.For(nameof(QueryTimingsScope.Names.Storage)))
                {
                    var doc = DirectGet(null, id, state);

                    if (doc != null)
                    {
                        doc.IndexScore = score;
                    }

                    return(doc);
                }
            }
        }
        public override Document Get(Lucene.Net.Documents.Document input, float score, IState state)
        {
            if (FieldsToFetch.IsProjection)
            {
                return(GetProjection(input, score, null, state));
            }

            using (_storageScope = _storageScope?.Start() ?? RetrieverScope?.For(nameof(QueryTimingsScope.Names.Storage)))
                return(DirectGet(input, null, state));
        }
Пример #3
0
        public override Document Get(Lucene.Net.Documents.Document input, ScoreDoc scoreDoc, IState state)
        {
            if (FieldsToFetch.IsProjection)
            {
                return(GetProjection(input, scoreDoc, null, state));
            }

            using (_storageScope = _storageScope?.Start() ?? RetrieverScope?.For(nameof(QueryTimingsScope.Names.Storage)))
            {
                var doc = DirectGet(input, null, DocumentFields.All, state);

                FinishDocumentSetup(doc, scoreDoc);

                return(doc);
            }
        }
        public override Document Get(Lucene.Net.Documents.Document input, float score, IState state)
        {
            if (FieldsToFetch.IsProjection)
            {
                return(GetProjection(input, score, null, state));
            }

            using (_storageScope = _storageScope?.Start() ?? RetrieverScope?.For(nameof(QueryTimingsScope.Names.Storage)))
            {
                var doc = DirectGet(input, null, DocumentFields.All, state);

                if (doc != null)
                {
                    doc.IndexScore = score;
                }

                return(doc);
            }
        }
Пример #5
0
        public override (Document Document, List <Document> List) Get(Lucene.Net.Documents.Document input, Lucene.Net.Search.ScoreDoc scoreDoc, IState state, CancellationToken token)
        {
            using (RetrieverScope?.Start())
            {
                if (TryGetKey(input, state, out string id) == false)
                {
                    throw new InvalidOperationException($"Could not extract '{Constants.Documents.Indexing.Fields.DocumentIdFieldName}' from index.");
                }

                if (FieldsToFetch.IsProjection)
                {
                    return(GetProjection(input, scoreDoc, id, state, token));
                }

                using (_storageScope = _storageScope?.Start() ?? RetrieverScope?.For(nameof(QueryTimingsScope.Names.Storage)))
                {
                    var doc = DirectGet(null, id, DocumentFields, state);

                    FinishDocumentSetup(doc, scoreDoc);
                    return(doc, null);
                }
            }
        }