/* 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;
/** Element of a SortSpec.
*
* SortRules are the building blocks used to assemble
* [SortSpecs](cfish:SortSpec); each SortRule defines a single
* level of sorting. For example, sorting first by "category" then by score
* requires a SortSpec with two SortRule elements.
*/
public class Lucy::Search::SortRule inherits Clownfish::Obj {
int32_t type;
String *field;
bool reverse;
inert int32_t FIELD;
inert int32_t SCORE;
inert int32_t DOC_ID;
/** Create a new SortRule.
*
* @param type Indicate whether to sort by score, field, etc. (The
* default is to sort by a field.)
* @param field The name of a `sortable` field.
* @param reverse If true, reverse the order of the sort for this rule.
*/
public inert incremented SortRule*
new(int32_t type = 0, String *field = NULL,
bool reverse = false);
/** Initialize a SortRule. See [](.new) for a description of the
* parameters.
*/
public inert incremented SortRule*
init(SortRule *self, int32_t type = 0, String *field = NULL,
bool reverse = false);
/** Accessor for "field" member.
*/
public nullable String*
Get_Field(SortRule *self);
/** Accessor for "type" member.
*/
public int32_t
Get_Type(SortRule *self);
/** Accessor for "reverse" member.
*/
public bool
Get_Reverse(SortRule *self);
void
Serialize(SortRule *self, OutStream *outstream);
incremented SortRule*
Deserialize(decremented SortRule *self, InStream *instream);
public void
Destroy(SortRule *self);
}