The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
/* 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;

/** Leaf node in a tree created by QueryParser.
 *
 * LeafQuery objects serve as leaf nodes in the tree structure generated by
 * L<QueryParser|Lucy::Search::QueryParser>'s Tree() method.
 * Ultimately, they must be transformed, typically into either
 * L<TermQuery|Lucy::Search::TermQuery> or
 * L<PhraseQuery|Lucy::Search::PhraseQuery> objects, as attempting to
 * search a LeafQuery causes an error.
 */
class Lucy::Search::LeafQuery inherits Lucy::Search::Query
    : dumpable {

    CharBuf *field;
    CharBuf *text;

    inert incremented LeafQuery*
    new(const CharBuf *field = NULL, const CharBuf *text);

    /**
     * @param field Optional field name.
     * @param text Raw query text.
     */
    public inert LeafQuery*
    init(LeafQuery *self, const CharBuf *field = NULL, const CharBuf *text);

    /** Accessor for object's <code>field</code> attribute.
     */
    public nullable CharBuf*
    Get_Field(LeafQuery *self);

    /** Accessor for object's <code>text</code> attribute.
     */
    public CharBuf*
    Get_Text(LeafQuery *self);

    public bool_t
    Equals(LeafQuery *self, Obj *other);

    public incremented CharBuf*
    To_String(LeafQuery *self);

    public void
    Serialize(LeafQuery *self, OutStream *outstream);

    public incremented LeafQuery*
    Deserialize(LeafQuery *self, InStream *instream);

    /** Throws an error.
     */
    public incremented Compiler*
    Make_Compiler(LeafQuery *self, Searcher *searcher, float boost,
                  bool_t subordinate = false);

    public void
    Destroy(LeafQuery *self);
}