On Wed, Apr 29, 2015 at 10:20 AM, Bruno Albuquerque <[email protected]> wrote:
> Is there a complete description of the query language acepted by
> QueryParser anyway? I saw the general description at the perl documentation
> but I am unable to put it to practice.
>
> For example, I have a indexed field (say "field") and I want to do a search
> for documents that have the string A on that field (and I only want
> documents that satisfy it back). I tried with:
>
> field:A
>
> This did not return anythng.
>
> Then I tried:
>
> field:(A)
>
> This returned results that had the string in the field but also returned
> results that did not have the string in the field.
>
> I am using IxSearcher_Hits() and passing the strings themselves (the
> example above) as the query.
>
> What am I missing?
The `fieldname:content` syntax isn't enabled by default. Does this help?
QueryParser *qparser = QParser_new(IxSearcher_Get_Schema(searcher),
NULL, NULL, NULL);
QParser_Set_Heed_Colons(qparser, true);
Query *query = QParser_Parse(qparser, query_string);
Hits *hits = IxSearcher_Hits(searcher, (Obj*)query, 0, 10, NULL);
Marvin Humphrey