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
 * [](cfish:QueryParser)'s [](cfish:QueryParser.Tree) method.
 * Ultimately, they must be transformed, typically into either
 * [](cfish:TermQuery) or
 * [](cfish:PhraseQuery) objects, as attempting to
 * search a LeafQuery causes an error.
 */
public class Lucy::Search::LeafQuery inherits Lucy::Search::Query {

    String *field;
    String *text;

    /** Create a new LeafQuery.
     *
     * @param field Optional field name.
     * @param text Raw query text.
     */
    public inert incremented LeafQuery*
    new(String *field = NULL, String *text);

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

    /** Accessor for object's `field` attribute.
     */
    public nullable String*
    Get_Field(LeafQuery *self);

    /** Accessor for object's `text` attribute.
     */
    public String*
    Get_Text(LeafQuery *self);

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

    public incremented String*
    To_String(LeafQuery *self);

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

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

    public incremented Obj*
    Dump(LeafQuery *self);

    public incremented Obj*
    Load(LeafQuery *self, Obj *dump);

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

    public void
    Destroy(LeafQuery *self);
}