kasilak wrote on 2/17/17 6:35 PM:
Sharing the complete C code for search.c.


    //To handle proximity queries
    if( queryType[g_testProximity] )
    {
        Vector *terms = Vec_new(0);
        Vec_Push(terms, (Obj*)query_str);

        String *field_name = Str_newf("content");
        pquery = (Query*)ProximityQuery_new(field_name, terms, 100);


^^^ that won't work if `terms` is not first analyzed. If your index uses stemming or case normalization or anything else, then `terms` will not match anything in the lexicon.

What I pointed at earlier in this thread is how the C QueryParser handles phrases, which is very similar to what must happen for proximity. A proximity is just a phrase with the positions in a range <= maxdistance.

Since the built-in QueryParser does not yet handle proximity syntax, you'd need to detect that case and parse it out yourself.

Or better yet, patch the Lucy QueryParser to recognize the proximity syntax and submit that back here as a pull request.

The relevant place to start looking is here:

https://github.com/apache/lucy/blob/master/core/Lucy/Search/QueryParser.c#L862

and look at the logic around `is_phrase`.

HTH,
pek


--
Peter Karman  .  https://peknet.com/  .  https://keybase.io/peterkarman

Reply via email to