/* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ parcel Lucy; /** Retrieve stored documents. * * DocReader defines the interface by which documents (with all stored fields) * are retrieved from the index. The default implementation returns * L objects. */ public class Lucy::Index::DocReader inherits Lucy::Index::DataReader { inert DocReader* init(DocReader *self, Schema *schema = NULL, Folder *folder = NULL, Snapshot *snapshot = NULL, VArray *segments = NULL, int32_t seg_tick = -1); /** Retrieve the document identified by doc_id. * * @return a HitDoc. */ public abstract incremented HitDoc* Fetch_Doc(DocReader *self, int32_t doc_id); /** Returns a DocReader which divvies up requests to its sub-readers * according to the offset range. * * @param readers An array of DocReaders. * @param offsets Doc id start offsets for each reader. */ public incremented nullable DocReader* Aggregator(DocReader *self, VArray *readers, I32Array *offsets); } /** Aggregate multiple DocReaders. */ class Lucy::Index::PolyDocReader inherits Lucy::Index::DocReader { VArray *readers; I32Array *offsets; inert incremented PolyDocReader* new(VArray *readers, I32Array *offsets); inert PolyDocReader* init(PolyDocReader *self, VArray *readers, I32Array *offsets); public incremented HitDoc* Fetch_Doc(PolyDocReader *self, int32_t doc_id); public void Close(PolyDocReader *self); public void Destroy(PolyDocReader *self); } class Lucy::Index::DefaultDocReader cnick DefDocReader inherits Lucy::Index::DocReader { InStream *dat_in; InStream *ix_in; inert incremented DefaultDocReader* new(Schema *schema, Folder *folder, Snapshot *snapshot, VArray *segments, int32_t seg_tick); inert DefaultDocReader* init(DefaultDocReader *self, Schema *schema, Folder *folder, Snapshot *snapshot, VArray *segments, int32_t seg_tick); public incremented HitDoc* Fetch_Doc(DefaultDocReader *self, int32_t doc_id); /** Read the raw byte content for the specified doc into the supplied * buffer. */ void Read_Record(DefaultDocReader *self, ByteBuf *buffer, int32_t doc_id); public void Close(DefaultDocReader *self); public void Destroy(DefaultDocReader *self); }