/* 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; /** Read Lexicon data. * * LexiconReader reads term dictionary information. */ public abstract class Lucy::Index::LexiconReader cnick LexReader inherits Lucy::Index::DataReader { inert LexiconReader* init(LexiconReader *self, Schema *schema = NULL, Folder *folder = NULL, Snapshot *snapshot = NULL, VArray *segments = NULL, int32_t seg_tick = -1); /** Return a new Lexicon for the given field. Will return * NULL if either the field is not indexed, or if no documents contain a * value for the field. * * @param field Field name. * @param term Pre-locate the Lexicon to this term. */ public abstract incremented nullable Lexicon* Lexicon(LexiconReader *self, const CharBuf *field, Obj *term = NULL); /** Return the number of documents where the specified term is present. */ public abstract uint32_t Doc_Freq(LexiconReader *self, const CharBuf *field, Obj *term); /** If the term can be found, return a term info, otherwise return NULL. */ abstract incremented nullable TermInfo* Fetch_Term_Info(LexiconReader *self, const CharBuf *field, Obj *term); /** Return a LexiconReader which merges the output of other * LexiconReaders. * * @param readers An array of LexiconReaders. * @param offsets Doc id start offsets for each reader. */ public incremented nullable LexiconReader* Aggregator(LexiconReader *self, VArray *readers, I32Array *offsets); } class Lucy::Index::PolyLexiconReader cnick PolyLexReader inherits Lucy::Index::LexiconReader { VArray *readers; I32Array *offsets; inert incremented PolyLexiconReader* new(VArray *readers, I32Array *offsets); inert PolyLexiconReader* init(PolyLexiconReader *self, VArray *readers, I32Array *offsets); public incremented nullable Lexicon* Lexicon(PolyLexiconReader *self, const CharBuf *field, Obj *term = NULL); public uint32_t Doc_Freq(PolyLexiconReader *self, const CharBuf *field, Obj *term); public void Close(PolyLexiconReader *self); public void Destroy(PolyLexiconReader *self); } class Lucy::Index::DefaultLexiconReader cnick DefLexReader inherits Lucy::Index::LexiconReader { VArray *lexicons; inert incremented DefaultLexiconReader* new(Schema *schema, Folder *folder, Snapshot *snapshot, VArray *segments, int32_t seg_tick); inert DefaultLexiconReader* init(DefaultLexiconReader *self, Schema *schema, Folder *folder, Snapshot *snapshot, VArray *segments, int32_t seg_tick); public incremented nullable Lexicon* Lexicon(DefaultLexiconReader *self, const CharBuf *field, Obj *term = NULL); /** Return the number of documents in which the term appears. */ public uint32_t Doc_Freq(DefaultLexiconReader *self, const CharBuf *field, Obj *term); incremented nullable TermInfo* Fetch_Term_Info(DefaultLexiconReader *self, const CharBuf *field, Obj *term); public void Close(DefaultLexiconReader *self); public void Destroy(DefaultLexiconReader *self); }