AWS CloudSearch - Can not fetch words that end with string

0

I'm using CloudSearch of Amazon . But I have a problem finding the words that end with a certain term, I can not perform this type of search, it returns me only the records that begin with the term, for example: I have registered TESTEA and ATESTE .

Type: TESTE* or TESTE or *TESTE

The result will be only relative to TESTEA

I have read the documentation and some topics and I did not succeed.

Has anyone ever had this problem and have any suggestions?

    
asked by anonymous 30.01.2018 / 19:34

1 answer

0

After a few sample attempts and to no avail. I solved it as follows:

I created a text-array field and stored it part of the string back and forth.

example: my string is "abcde" and I search for bcde. this would not work but in my field text-field will be the following strings: and, from, cde, bcde, abcde. So you will find "abcde" because you will find the term in the text-array field.

Putz, but what if I look for "bcd" this term is not in the text-array field. Beauty but the string "bcde" starts with "bcd" being thus you will find.

My php file to insert looks like this:

$term = "abcde";

$arrStr = str_split($term);
$arrTerms = [];
$aux = 1;
foreach($arrStr as $str){
    $arrTerms[] = substr($term,($aux * -1));
    $aux++;
}

$data = [
    'type'   => 'add',
    'id'     => [your_id],
    'fields' => [
        'id' => [your_id],
        'field-text' => $term
        'field-text-array' => $arrTerms

    ],
];
    
02.02.2018 / 21:21