Web / Apache Solr Interview questions
Which is better for autocomplete, EdgeNGram or the Suggester component, and why?
Both can power autocomplete, but they trade off index size, relevance, and speed differently, so "better" depends on the requirement.
| EdgeNGram field | Suggester component |
| Generates prefix n-grams at index time ("s","so","sol","solr") | Builds a dedicated finite-state transducer (FST) structure from source data |
| Works through the normal query pipeline; easy to combine with filters | Needs a separate build step and its own request handler |
| Larger index size due to stored n-grams per term | Very fast lookups; compact structure optimized purely for prefix matching |
| Scores using normal relevance ranking | Typically ranked by weight/frequency rather than full relevance scoring |
For a simple, fast "type-ahead" box where suggestions come from a bounded vocabulary (product names, search terms), the Suggester is usually the better fit: it's purpose-built, faster, and doesn't bloat the main index. EdgeNGram makes more sense when autocomplete needs to respect the same filters, boosts, and relevance logic as regular search, at the cost of a heavier index and less specialized latency.
More Related questions...