Commit Graph

12 Commits

Author SHA1 Message Date
seb
462041654d Optimize search result finalization by reallocating in place
Replace the malloc/copy/free sequence with a single realloc that
shrinks temp_results to its exact size and returns it directly.  This

* eliminates an extra allocation and memory copy
* simplifies cleanup logic
* retains correct failure handling (temp_results unchanged on realloc
  failure)

Also drop the superfluous trailing space at EOF and add package-lock.json
to version control to lock Node.js dependencies.
2025-06-23 04:16:18 +02:00
seb
60d609dd6a Fix Windows compilation issue by adding malloc.h include 2025-06-21 21:14:20 +02:00
seb
24895fc1bc similarity_search.c aktualisiert
3 -> 2 (min word length)
2025-04-22 04:35:04 +00:00
seb
a9a9247773 Refactor word similarity calculation in similarity_search.c to simplify scoring logic. Replace prefix matching with Levenshtein distance for improved accuracy, and adjust similarity scoring to boost results for small differences. Update overall similarity calculation to average word match ratio and average word similarity for better performance. 2025-04-18 19:01:22 +02:00
seb
e2aacaf54b Refactor similarity_search.c to improve memory management and word splitting logic. Simplify split_into_words function to use a single allocation and update free_words to handle memory more efficiently. Enhance levenshtein_distance calculation with dynamic memory allocation and optimize similarity scoring in calculate_similarity function for better accuracy and performance. 2025-04-18 18:55:37 +02:00
seb
92a7bad2b6 Implement Levenshtein distance calculation for improved word similarity in similarity_search.c. Adjust similarity thresholds and scoring logic to enhance accuracy, particularly for prefix matches and varying word lengths. Update test.js to reflect new search scenarios with lower similarity thresholds. 2025-04-18 09:47:58 +02:00
seb
e94c034927 Refine word similarity calculation in similarity_search.c by enforcing exact matches for short words and adjusting similarity thresholds. Increase weight of word matches in overall similarity score calculation. 2025-04-18 09:32:44 +02:00
seb
cd41ca2f52 Add word similarity calculation to enhance overall similarity scoring in calculate_similarity function. Implement character matching logic and boost score for same-length words. 2025-04-18 09:20:44 +02:00
seb
6091cc0b80 Increase default capacity in SearchIndexWrapper and enhance similarity calculation in calculate_similarity function to boost similarity score when all query words are found. Update MAX_WORDS and MAX_STRING_LEN definitions for improved handling. 2025-04-18 09:16:26 +02:00
seb
da5e7476a0 Implement input validation for string length and index capacity in similarity_search_addon.cc and similarity_search.c; enhance memory management in search_index function. 2025-04-18 08:57:35 +02:00
seb
de950fa11c Enhance string handling in similarity_search.c with input validation and memory management improvements; update test.js to utilize new SimilaritySearch class for index creation. 2025-04-18 08:52:18 +02:00
seb
51a3cc6c2d genesis 2025-04-18 08:22:35 +02:00