You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucy.apache.org by Bruno Albuquerque <bg...@bug-br.org.br> on 2015/04/29 19:20:33 UTC

[lucy-dev] Description of query language.

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?

Re: [lucy-dev] Description of query language.

Posted by Bruno Albuquerque <bg...@bug-br.org.br>.
That did the trick, thanks.


Em qua, 29 de abr de 2015 às 15:27, Marvin Humphrey <ma...@rectangular.com>
escreveu:

> On Wed, Apr 29, 2015 at 10:20 AM, Bruno Albuquerque <bg...@bug-br.org.br>
> 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
>

Re: [lucy-dev] Description of query language.

Posted by Marvin Humphrey <ma...@rectangular.com>.
On Wed, Apr 29, 2015 at 10:20 AM, Bruno Albuquerque <bg...@bug-br.org.br> 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