From ba83fbd2e55c7d682af64b0c5d9871442abb2390 Mon Sep 17 00:00:00 2001 From: Adam Shannon Date: Mon, 29 Jan 2024 10:45:35 -0600 Subject: [PATCH] feat: add SEARCH_MAX_WORKERS --- README.md | 5 +++-- cmd/server/main.go | 4 +++- docs/usage-configuration.md | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 80033f06..3e831313 100644 --- a/README.md +++ b/README.md @@ -184,15 +184,16 @@ You should get this response: PONG ``` -### Configuration settings +### Configuration settings | Environmental Variable | Description | Default | |-----|-----|-----| | `DATA_REFRESH_INTERVAL` | Interval for data redownload and reparse. `off` disables this refreshing. | 12h | | `INITIAL_DATA_DIRECTORY` | Directory filepath with initial files to use instead of downloading. Periodic downloads will replace the initial files. | Empty | +| `SEARCH_MAX_WORKERS` | Maximum number of goroutines used for search. | 1024 | | `ADJACENT_SIMILARITY_POSITIONS` | How many nearby words to search for highest max similarly score. | 3 | | `EXACT_MATCH_FAVORITISM` | Extra weighting assigned to exact matches. | 0.0 | -| `LENGTH_DIFFERENCE_CUTOFF_FACTOR` | Minimum ratio for the length of two matching tokens, before they score is penalised. | 0.9 | +| `LENGTH_DIFFERENCE_CUTOFF_FACTOR` | Minimum ratio for the length of two matching tokens, before they score is penalised. | 0.9 | | `LENGTH_DIFFERENCE_PENALTY_WEIGHT` | Weight of penalty applied to scores when two matching tokens have different lengths. | 0.3 | | `DIFFERENT_LETTER_PENALTY_WEIGHT` | Weight of penalty applied to scores when two matching tokens begin with different letters. | 0.9 | | `UNMATCHED_INDEX_TOKEN_WEIGHT` | Weight of penalty applied to scores when part of the indexed name isn't matched. | 0.15 | diff --git a/cmd/server/main.go b/cmd/server/main.go index 6d8609de..604fe4d9 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -149,7 +149,9 @@ func main() { } else { pipeline = newPipeliner(log.NewNopLogger()) } - searcher := newSearcher(logger, pipeline, *flagWorkers) + + searchWorkers := readInt(os.Getenv("SEARCH_MAX_WORKERS"), *flagWorkers) + searcher := newSearcher(logger, pipeline, searchWorkers) // Add debug routes adminServer.AddHandler(debugSDNPath, debugSDNHandler(logger, searcher)) diff --git a/docs/usage-configuration.md b/docs/usage-configuration.md index d298465f..4cbba0c7 100644 --- a/docs/usage-configuration.md +++ b/docs/usage-configuration.md @@ -12,6 +12,7 @@ menubar: docs-menu |-----|-----|-----| | `DATA_REFRESH_INTERVAL` | Interval for data redownload and reparse. `off` disables this refreshing. | 12h | | `INITIAL_DATA_DIRECTORY` | Directory filepath with initial files to use instead of downloading. Periodic downloads will replace the initial files. | Empty | +| `SEARCH_MAX_WORKERS` | Maximum number of goroutines used for search. | 1024 | | `ADJACENT_SIMILARITY_POSITIONS` | How many nearby words to search for highest max similarly score. | 3 | | `EXACT_MATCH_FAVORITISM` | Extra weighting assigned to exact matches. | 0.0 | | `JARO_WINKLER_BOOST_THRESHOLD` | Jaro-Winkler boost threshold. | 0.7 |