public function getSuggestions(LocaleEntity $locale, TranslatableEntity $translatable)
    {
        $result = [];
        $connection = $this->app->make(EntityManager::class)->getConnection();
        $rs = $connection->executeQuery(
            '
                select distinct
                    CommunityTranslationTranslatables.text,
                    CommunityTranslationTranslations.text0,
                    match(CommunityTranslationTranslatables.text) against (:search in natural language mode) as relevance
                from
                    CommunityTranslationTranslations
                    inner join CommunityTranslationTranslatables on CommunityTranslationTranslations.translatable = CommunityTranslationTranslatables.id and 1 = CommunityTranslationTranslations.current and :locale = CommunityTranslationTranslations.locale
                where
                    CommunityTranslationTranslatables.id <> :currentTranslatableID
                    and length(CommunityTranslationTranslatables.text) between :minLength and :maxLength
                having
                    relevance > 0
                order by
                    relevance desc,
                    text asc
                limit
                    0, ' . ((int) self::MAX_SUGGESTIONS) . '
            ',
            [
                'search' => $translatable->getText(),
                'locale' => $locale->getID(),
                'currentTranslatableID' => $translatable->getID(),
                'minLength' => (int) floor(strlen($translatable->getText()) * 0.75),
                'maxLength' => (int) ceil(strlen($translatable->getText()) * 1.33),
            ]
        );
        while ($row = $rs->fetch()) {
            $result[] = [
                'source' => $row['text'],
                'translation' => $row['text0'],
            ];
        }
        $rs->closeCursor();

        return $result;
    }
public function getSuggestions(LocaleEntity $locale, TranslatableEntity $translatable)
    {
        $result = [];
        $connection = $this->app->make(EntityManager::class)->getConnection();
        $rs = $connection->executeQuery(
            '
                select distinct
                    CommunityTranslationTranslatables.text,
                    CommunityTranslationTranslations.text0,
                    match(CommunityTranslationTranslatables.text) against (:search in natural language mode) as relevance
                from
                    CommunityTranslationTranslations
                    inner join CommunityTranslationTranslatables on CommunityTranslationTranslations.translatable = CommunityTranslationTranslatables.id and 1 = CommunityTranslationTranslations.current and :locale = CommunityTranslationTranslations.locale
                where
                    CommunityTranslationTranslatables.id <> :currentTranslatableID
                    and length(CommunityTranslationTranslatables.text) between :minLength and :maxLength
                having
                    relevance > 0
                order by
                    relevance desc,
                    text asc
                limit
                    0, ' . ((int) self::MAX_SUGGESTIONS) . '
            ',
            [
                'search' => $translatable->getText(),
                'locale' => $locale->getID(),
                'currentTranslatableID' => $translatable->getID(),
                'minLength' => (int) floor(strlen($translatable->getText()) * 0.75),
                'maxLength' => (int) ceil(strlen($translatable->getText()) * 1.33),
            ]
        );
        while ($row = $rs->fetch()) {
            $result[] = [
                'source' => $row['text'],
                'translation' => $row['text0'],
            ];
        }
        $rs->closeCursor();

        return $result;
    }
public function getSuggestions ( LocaleEntity $ locale , TranslatableEntity $ translatable ) { $ result = [ ] ; $ connection = $ this -> app -> make ( EntityManager :: class ) -> getConnection ( ) ; $ rs = $ connection -> executeQuery ( '
                select distinct
                    CommunityTranslationTranslatables.text,
                    CommunityTranslationTranslations.text0,
                    match(CommunityTranslationTranslatables.text) against (:search in natural language mode) as relevance
                from
                    CommunityTranslationTranslations
                    inner join CommunityTranslationTranslatables on CommunityTranslationTranslations.translatable = CommunityTranslationTranslatables.id and 1 = CommunityTranslationTranslations.current and :locale = CommunityTranslationTranslations.locale
                where
                    CommunityTranslationTranslatables.id <> :currentTranslatableID
                    and length(CommunityTranslationTranslatables.text) between :minLength and :maxLength
                having
                    relevance > 0
                order by
                    relevance desc,
                    text asc
                limit
                    0, ' . ( ( int ) self :: MAX_SUGGESTIONS ) . '
            ' , [ 'search' => $ translatable -> getText ( ) , 'locale' => $ locale -> getID ( ) , 'currentTranslatableID' => $ translatable -> getID ( ) , 'minLength' => ( int ) floor ( strlen ( $ translatable -> getText ( ) ) * 0.75 ) , 'maxLength' => ( int ) ceil ( strlen ( $ translatable -> getText ( ) ) * 1.33 ) , ] ) ; while ( $ row = $ rs -> fetch ( ) ) { $ result [ ] = [ 'source' => $ row [ 'text' ] , 'translation' => $ row [ 'text0' ] , ] ; } $ rs -> closeCursor ( ) ; return $ result ; }
Search for similar translations.

@param LocaleEntity $locale
@param TranslatableEntity $translatable

@return array
Search for similar translations .