Branch: Tag:

2013-01-29

2013-01-29 17:42:59 by Jonas Walldén <jonasw@roxen.com>

Keep blob feeders separate when same word occurs multiple times in a query.

The blobfeeder hook now gets a opaque stream ID in order to distinguish separate
instances of the same word. This fixes search results for phrase searches
like "foo bar foo".

387:   static void f_do_query_phrase( INT32 args )   /*! @decl ResultSet do_query_phrase( array(string) words, @    *! array(int) field_coefficients, @ -  *! function(int:string) blobfeeder) +  *! function(string,int,int:string) blobfeeder)    *! @param words    *!    *! Arrays of word ids. Note that the order is significant for the
408:    *! @param blobfeeder    *!    *! This function returns a Pike string containing the word hits for a -  *! certain word_id. Call repeatedly until it returns @expr{0@}. +  *! certain word. Call repeatedly until it returns @expr{0@}.    */   {    double proximity_coefficients[8];
453:   /*! @decl ResultSet do_query_and( array(string) words, @    *! array(int) field_coefficients, @    *! array(int) proximity_coefficients, @ -  *! function(int:string) blobfeeder) +  *! function(string,int,int:string) blobfeeder)    *! @param words    *!    *! Arrays of word ids. Note that the order is significant for the
499:    *! @param blobfeeder    *!    *! This function returns a Pike string containing the word hits for a -  *! certain word_id. Call repeatedly until it returns @expr{0@}. +  *! certain word. Call repeatedly until it returns @expr{0@}.    */   {    double proximity_coefficients[8];
553:   /*! @decl ResultSet do_query_or( array(string) words, @    *! array(int) field_coefficients, @    *! array(int) proximity_coefficients, @ -  *! function(int:string) blobfeeder) +  *! function(string,int,int:string) blobfeeder)    *! @param words    *!    *! Arrays of word ids. Note that the order is significant for the
599:    *! @param blobfeeder    *!    *! This function returns a Pike string containing the word hits for a -  *! certain word_id. Call repeatedly until it returns @expr{0@}. +  *! certain word. Call repeatedly until it returns @expr{0@}.    */   {    double proximity_coefficients[8];
661:       add_function( "do_query_or", f_do_query_or,    "function(array(string),array(int),array(int),int" -  ",function(string,int:string):object)", +  ",function(string,int,int:string):object)",    0 );       add_function( "do_query_and", f_do_query_and,    "function(array(string),array(int),array(int),int" -  ",function(string,int:string):object)", +  ",function(string,int,int:string):object)",    0 );       add_function( "do_query_phrase", f_do_query_phrase,    "function(array(string),array(int)" -  ",function(string,int:string):object)", +  ",function(string,int,int:string):object)",    0 );   }