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

Lucy::Search::Query

parcel Lucy
class variable LUCY_QUERY
struct symbol lucy_Query
class nickname lucy_Query
header file Lucy/Search/Query.h

Name

Lucy::Search::Query – A specification for a search query.

Description

Query objects are simple containers which contain the minimum information necessary to define a search query.

The most common way to generate Query objects is to feed a search string such as ‘foo AND bar’ to a QueryParser’s Parse() method, which outputs an abstract syntax tree built up from various Query subclasses such as ANDQuery and TermQuery. However, it is also possible to use custom Query objects to build a search specification which cannot be easily represented using a search string.

Subclasses of Query must implement Make_Compiler(), which is the first step in compiling a Query down to a Matcher which can actually match and score documents.

Functions

init
lucy_Query*
lucy_Query_init(
    lucy_Query *self,
    float boost
);

Abstract initializer.

boost

A scoring multiplier, affecting the Query’s relative contribution to each document’s score. Typically defaults to 1.0, but subclasses which do not contribute to document scores such as NOTQuery and MatchAllQuery default to 0.0 instead.

Methods

Make_Compiler (abstract)
lucy_Compiler* // incremented
lucy_Query_Make_Compiler(
    lucy_Query *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.

Set_Boost
void
lucy_Query_Set_Boost(
    lucy_Query *self,
    float boost
);

Set the Query’s boost.

Get_Boost
float
lucy_Query_Get_Boost(
    lucy_Query *self
);

Get the Query’s boost.

Dump
cfish_Obj* // incremented
lucy_Query_Dump(
    lucy_Query *self
);
Load
cfish_Obj* // incremented
lucy_Query_Load(
    lucy_Query *self,
    cfish_Obj *dump
);

Inheritance

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