Reputation: 256
I'm trying to write a query that works similar to autocomplete. I cannot use a suggester as I also need to add a filter query. I'm using the below query but it's not ignoring words preceded by a space.
q=(and ( prefix 'lond' ) (not (prefix ' lond') ) )
E.g. This returns City of London where it should only return London
Any ideas?
Upvotes: 0
Views: 209
Reputation: 256
The problem was with the way Amazon tokenizes Strings, splitting on space in paticular.
To work around this, I have created a new index field called autocomplete_name
where I simply join the String with underscores.
So City Of London
becomes City_Of_London
which is perfect for autocomplete.
Upvotes: 1