Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Amazon Cloudsearch not searching with partial string

I'm testing Amazon Cloudsearch for my web application and i'm running into some strange issues.

I have the following domain indexes: name, email, id.

For example, I have data such as: John Doe, [email protected], 1

When I search for jo I get nothing. If I search for joh I still get nothing, But if I search for john then I get the above document as a hit. Why is it not getting when I put partial strings? I even put suggestors on name and email with fuzzy matching enabled. Is there something else i'm missing? I read the below on this:

http://docs.aws.amazon.com/cloudsearch/latest/developerguide/searching-text.html

http://docs.aws.amazon.com/cloudsearch/latest/developerguide/searching.html

http://docs.aws.amazon.com/cloudsearch/latest/developerguide/searching-compound-queries.html

I'm doing the searches using boto as well as with the form on AWS page.

like image 492
KVISH Avatar asked Dec 14 '22 14:12

KVISH


1 Answers

What you're trying to do -- finding "john" by searching "jo" -- is a called a prefix search.

You can accomplish this either by searching

(prefix field=name 'jo')

or

q=jo*

Note that if you use the q=jo* method of appending * to all your queries, you may want to do something like q=jo* |jo because john* will not match john.

This can seem a little confusing but imagine if google gave back results for prefix matches: if you searched for tort and got back a mess of results about tortoises and torture instead of tort (a legal term), you would be very confused (and frustrated).

A suggester is also a viable approach but that's going to give you back suggestions (like john, jordan and jostle rather than results) that you would then need to search for; it does not return matching documents to you.

See "Searching for Prefixes in Amazon CloudSearch" at http://docs.aws.amazon.com/cloudsearch/latest/developerguide/searching-text.html

like image 96
alexroussos Avatar answered Jan 13 '23 09:01

alexroussos