Project Lucy has retired. For details please refer to its Attic page.
Lucy::Search::RequiredOptionalQuery – C API Documentation
Apache Lucy™

Lucy::Search::RequiredOptionalQuery

parcel Lucy
class variable LUCY_REQUIREDOPTIONALQUERY
struct symbol lucy_RequiredOptionalQuery
class nickname lucy_ReqOptQuery
header file Lucy/Search/RequiredOptionalQuery.h

Name

Lucy::Search::RequiredOptionalQuery – Join results for two Queries, one required, one optional.

Description

RequiredOptionalQuery joins the result sets of one Query which MUST match, and one Query which SHOULD match. When only the required Query matches, its score is passed along; when both match, the scores are summed.

Functions

new
lucy_RequiredOptionalQuery* // incremented
lucy_ReqOptQuery_new(
    lucy_Query *required_query,
    lucy_Query *optional_query
);

Create a new RequiredOptionalQuery.

required_query

Query must must match.

optional_query

Query which should match.

init
lucy_RequiredOptionalQuery*
lucy_ReqOptQuery_init(
    lucy_RequiredOptionalQuery *self,
    lucy_Query *required_query,
    lucy_Query *optional_query
);

Initialize a RequiredOptionalQuery.

required_query

Query must must match.

optional_query

Query which should match.

Methods

Get_Required_Query
lucy_Query*
lucy_ReqOptQuery_Get_Required_Query(
    lucy_RequiredOptionalQuery *self
);

Getter for the required Query.

Set_Required_Query
void
lucy_ReqOptQuery_Set_Required_Query(
    lucy_RequiredOptionalQuery *self,
    lucy_Query *required_query
);

Setter for the required Query.

Get_Optional_Query
lucy_Query*
lucy_ReqOptQuery_Get_Optional_Query(
    lucy_RequiredOptionalQuery *self
);

Getter for the optional Query.

Set_Optional_Query
void
lucy_ReqOptQuery_Set_Optional_Query(
    lucy_RequiredOptionalQuery *self,
    lucy_Query *optional_query
);

Setter for the optional Query.

Make_Compiler
lucy_Compiler* // incremented
lucy_ReqOptQuery_Make_Compiler(
    lucy_RequiredOptionalQuery *self,
    lucy_Searcher *searcher,
    float boost,
    bool subordinate
);

Abstract factory method returning a Compiler derived from this Query.

searcher

A Searcher.

boost

A scoring multiplier.

subordinate

Indicates whether the Query is a subquery (as opposed to a top-level query). If false, the implementation must invoke Normalize() on the newly minted Compiler object before returning it.

To_String
cfish_String* // incremented
lucy_ReqOptQuery_To_String(
    lucy_RequiredOptionalQuery *self
);

Generic stringification: “ClassName@hex_mem_address”.

Equals
bool
lucy_ReqOptQuery_Equals(
    lucy_RequiredOptionalQuery *self,
    cfish_Obj *other
);

Indicate whether two objects are the same. By default, compares the memory address.

other

Another Obj.

Methods inherited from Lucy::Search::PolyQuery

Add_Child
void
lucy_ReqOptQuery_Add_Child(
    lucy_RequiredOptionalQuery *self,
    lucy_Query *query
);

Add a child Query node.

Dump
cfish_Obj* // incremented
lucy_ReqOptQuery_Dump(
    lucy_RequiredOptionalQuery *self
);
Load
cfish_Obj* // incremented
lucy_ReqOptQuery_Load(
    lucy_RequiredOptionalQuery *self,
    cfish_Obj *dump
);

Methods inherited from Lucy::Search::Query

Set_Boost
void
lucy_ReqOptQuery_Set_Boost(
    lucy_RequiredOptionalQuery *self,
    float boost
);

Set the Query’s boost.

Get_Boost
float
lucy_ReqOptQuery_Get_Boost(
    lucy_RequiredOptionalQuery *self
);

Get the Query’s boost.

Inheritance

Lucy::Search::RequiredOptionalQuery is a Lucy::Search::PolyQuery is a Lucy::Search::Query is a Clownfish::Obj.