From 0f5b69c06b5ac6bac932ebf631f110c7b5f2f7ec Mon Sep 17 00:00:00 2001 From: Al Date: Mon, 27 Jul 2015 16:35:18 -0400 Subject: [PATCH] [fix] transition to SEARCH_STATE_NO_MATCH in trie_search_tokens_from_index on a return to the start node --- src/trie_search.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/trie_search.c b/src/trie_search.c index c6e4c7fe..91cdd5f4 100644 --- a/src/trie_search.c +++ b/src/trie_search.c @@ -310,7 +310,7 @@ phrase_array *trie_search_tokens_from_index(trie_t *self, char *str, token_array } - if (node.check <= 0) { + if (node.check <= 0 || node_id == start_node_id) { state = SEARCH_STATE_NO_MATCH; // check if (last_match_index != -1) { @@ -351,6 +351,7 @@ phrase_array *trie_search_tokens_from_index(trie_t *self, char *str, token_array log_debug("data = %d\n", data); last_match_index = i; + log_debug("last_match_index = %d\n", i); } if (i == tokens->n - 1) {