Hello ! I'd like to use natural language queries l...
# community-help
g
Hello ! I'd like to use natural language queries like:
"bts informatique à Paris" "je cherche une licence pro en alternance à Bordeaux" "école d'ingénieurs près de Lyon pour faire de l'IA"
And I want to extract structured entities out of these before hitting Typesense:
Copy code
{
  "diploma": "BTS",
  "field": "informatique",
  "city": "Paris",
  "query": "informatique"
}
So that
city
and
diploma
become
filter_by
parameters, and the remaining intent becomes the actual
q
— instead of throwing the whole raw string at Typesense and hoping for the best. What I've considered so far: Dictionary lookup for cities (BAN communes dataset, ~35k entries) Regex patterns for diploma types (
BTS
,
BUT
,
licence
,
master
, `prépa`…) Is there a lightweight, JS-compatible approach that handles all three entity types / facet (city + diploma + field) well enough for production, without needing a full ML runtime? I know about the natural language search which has landed in v29 but it seems a bit overkill for a quick Named Entity Recognition.
Thanks for your help !
a
Hey Gabriel, Typesense's NLS feature (v29+) is actually purpose-built for exactly this, if you use a local model, the overhead for implementing it's quite small. It takes a natural language query and outputs structured
q
,
filter_by
, and
sort_by
parameters. If you absolutely want to avoid LLM dependency, the dictionary + regex approach you described is the standard lightweight alternative, but Typesense offers no built-in NER outside of NLS.
a
hey @Alan Martini, we're also interested in NLS/Query Understanding layer on top of typesense, but are worried that having an LLM in hot path might increase latency (and cost) too much. Do you have recommendations for local models or cloud models which work best for this? What kind of latency hit can we expect?
a
@Apoorv Singh Both (local and cloud models) will indeed add some latency. With local models this is very small, around 100-200ms, while cloud models can add 500ms to 2seconds. Cloud models will have a bigger quality, while local models less. From a UX perspective though, this should be ok. With NL you won't be implementing a results as you type, but rather write down what you want and search once.