else
{*/
while(0 == code) {
- down_word = g_utf8_casefold((gchar*)(search.data),-1);
+ tmp = g_strconcat ((gchar*)(search.data), " ", NULL);
+ down_word = g_utf8_casefold(tmp,-1);
+ g_free (tmp);
+ tmp = g_utf8_casefold ((gchar*)(search.data),-1);
- if( g_pattern_match_string( regex, down_word ) == TRUE )
+ if(( g_pattern_match_string( regex, down_word ) == TRUE ) ||
+ ( g_pattern_match_string( regex, tmp ) == TRUE ))
{
tmp = g_strdup(search.data);
g_array_append_val(result, tmp );
//eg_free(reply.data);
eg_free(down_word);
code = data->db_words->seq(data->db_words, &search, &reply, R_NEXT);
+ g_free (tmp);
}
bm_timer(TIMER_STOP,(gchar*)(gchar*)__FUNCTION__);
gint readed =0;
gint offset = 0;
gchar* tmp = NULL;
+ gchar* tmp1 = NULL;
+ gchar* tmp2 = NULL;
guint len = 0;
// guint pl = strlen(pattern);
GPatternSpec* regex;
further = (readed == (WORD_LIST_BUFFER_LENGTH-offset));
}
tmp = buffer;
-
+
guint i = 0;
gint min = _MIN(readed, WORD_LIST_BUFFER_LENGTH-270);
while(i<min)
{
+ tmp1 = g_strconcat (tmp, " ", NULL);
+ tmp2 = g_utf8_casefold(tmp1, -1);
+ g_free (tmp1);
+ tmp1 = g_utf8_casefold(tmp, -1);
+
// check next words
- if(g_pattern_match_string (regex, tmp) == TRUE)
+ if ((g_pattern_match_string (regex, tmp1) == TRUE) ||
+ (g_pattern_match_string (regex, tmp2) == TRUE))
{
gchar* new = g_strdup(tmp);
g_array_append_val(result,new);
pattern
);
}
+
+ g_free (tmp1);
+ g_free (tmp2);
// calculate length of word
len = strlen(tmp)+1;
// jump in buffer over this word, and ...
// update i value
i = i + len + 2 * sizeof(guint);
}
+
offset = WORD_LIST_BUFFER_LENGTH - i;
g_memmove(buffer,buffer+WORD_LIST_BUFFER_LENGTH-offset, offset);
}
//------------------------------------------------------------------------------
static void search_word_list_end(void *data, const char *el)
{
- static gint compare_result = 0;
static gboolean matched = FALSE;
static gchar* tmp = NULL;
return;
}
- tmp = g_utf8_casefold(loc_data->last_word, -1);
-
+ gchar *tmp1 = g_strconcat (loc_data->last_word, " ", NULL);
+ tmp = g_utf8_casefold(tmp1, -1);
+ g_free (tmp1);
+ tmp1 = g_utf8_casefold(loc_data->last_word, -1);
+
/* if(loc_data->last_word_length > loc_data->pattern_len)
{
tmp[loc_data->pattern_len] = '\0';
};*/
- compare_result = g_pattern_match_string (regex, tmp);
- if( ( loc_data->last_word_length >= loc_data->pattern_len ) &&
- ( compare_result == TRUE ) )
+// if ( loc_data->last_word_length >= loc_data->pattern_len )
+ if (( g_pattern_match_string (regex, tmp) == TRUE ) ||
+ ( g_pattern_match_string (regex, tmp1) == TRUE ) )
{
matched = TRUE;
gchar* new = g_strdup(loc_data->last_word);
loc_data->cont = FALSE;
};
g_free(tmp); tmp = NULL;
+ g_free(tmp1);
g_pattern_spec_free (regex);
}
//------------------------------------------------------------------------------
guint max_length = 0;
guint64 file_size = get_file_size(data->cache);
gchar* casefold_pattern = g_utf8_casefold(pattern, -1);
- //gchar* casefold_word = NULL;
- guint pattern_len = strlen(pattern);
+// gchar* casefold_word = NULL;
+// guint pattern_len = strlen(pattern);
GPatternSpec* regex;
regex = g_pattern_spec_new (casefold_pattern);
++i;
memcpy(&record_length, buf, sizeof(guint));
buf[record_length-sizeof(guint)*2] = '\0';
- gchar* tmp = g_utf8_casefold(buf + sizeof(guint), -1);
- if(((record_length - 3*sizeof(guint)) >= pattern_len) &&
- ( g_pattern_match_string (regex, tmp) == TRUE ) ) {
+ gchar *tmp1 = g_strconcat (buf + sizeof(guint), " ", NULL);
+ gchar* tmp = g_utf8_casefold(tmp1, -1);
+ g_free (tmp1);
+
+// if (record_length - 3*sizeof(guint)) >= pattern_len)
+
+ if ( g_pattern_match_string (regex, tmp) == TRUE ) {
gchar* new = g_strndup(buf + sizeof(guint),
record_length -
3*sizeof(guint));