lucy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kasilak <kasi.anbum...@gmail.com>
Subject Re: [lucy-user] ProxmityQuery in C
Date Tue, 21 Feb 2017 23:26:49 GMT
Thanks Nick and Peter. Now ProximityQuery is working. Sharing the code
excerpts if anyone else would like to use.

My search string is of the form "animal render"~100, where 100 is the within
distance.

    String *content_str = Str_newf("content"); //field_name
  
    //To handle proximity queries
    if( queryType[g_testProximity] )
    {
        //String *field_name = Str_newf("content");
        Analyzer *analyzer = Schema_Fetch_Analyzer(schema, content_str);
        Vector *terms = Analyzer_Split(analyzer, query_str);

        String     *token = (String *)Vec_Pop(terms);
        uint32_t   within = Str_To_I64(token);

        printf("Search within=%d and Vec_Size=%zu\n", within,
Vec_Get_Size(terms));

        pquery = ProximityQuery_new(content_str, terms, within);

        DECREF(terms);
    }

    Hits 
     *hits = IxSearcher_Hits(searcher, (Obj*)pquery, 0, numWanted, NULL);
     Highlighter
       *highlighter = Highlighter_new((Searcher*)searcher, (Obj*)pquery,
content_str, 200);





--
View this message in context: http://lucene.472066.n3.nabble.com/lucy-user-ProxmityQuery-in-C-tp4320613p4321538.html
Sent from the lucy-user mailing list archive at Nabble.com.

Mime
View raw message