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.