Having problem while searching the two words "One Two", do i Need mapping for it


(_chetansharma) #1

$query = new Elastica_Query_Wildcard('title', $term . '*');
$query_ = new Elastica_Query($query);
$query_->setLimit($json['limit']);
$query_->setFrom($json['offset']);
$result_set = $search_type->search($query_);

This is what i am i using to get the results form the ElasticSearch, but it
works until there is no WhiteSpace in $term like "O", "On", "One"

but as soon I add next word, nothing is searched at all that is "One T"

I have tried the TextQuery as well

$query = new Elastica_Query_Text();
$query->setField('title', $term);

$query_ = new Elastica_Query($query);
$query_->setLimit($json['limit']);
$query_->setFrom($json['offset']);
$result_set = $search_type->search($query_);

Can someone please help.

Actually need to implement Autocomplete feature , but i don't have core
knowledge of ElasticSearch, working on the Upper layer with PHP Only. I have
heared I need to do Mapping for my content, what exactly does that mean,
didn't find any good document for this.

Thanks, any help will be much appreciated.

Thanks


(system) #2