Package org.zanata.webtrans.shared.model

Examples of org.zanata.webtrans.shared.model.TransMemoryQuery


    @Override
    public GetTranslationMemoryResult execute(GetTranslationMemory action,
            ExecutionContext context) throws ActionException {
        identity.checkLoggedIn();

        TransMemoryQuery transMemoryQuery = action.getQuery();
        log.debug("Fetching matches for {}", transMemoryQuery);

        List<TransMemoryResultItem> results =
                translationMemoryServiceImpl.searchTransMemory(
                        action.getLocaleId(), action.getSourceLocaleId(),
View Full Code Here


    }

    @Override
    public void fireSearchEvent() {
        String query = display.getTmTextBox().getText();
        createTMRequest(new TransMemoryQuery(query, display.getSearchType()
                .getValue()));
    }
View Full Code Here

    }

    public void createTMRequestForTransUnit(TransUnit transUnit) {
        // Start automatically fuzzy search
        SearchType searchType = SearchType.FUZZY_PLURAL;
        createTMRequest(new TransMemoryQuery(transUnit.getSources(), searchType));
    }
View Full Code Here

    }

    @Test
    public void testExecute() throws Exception {
        // Given: hibernate search can not parse query
        TransMemoryQuery query =
                new TransMemoryQuery("file removed",
                        HasSearchType.SearchType.FUZZY);

        List<TransMemoryResultItem> dummyResults = Lists.newArrayList();

        when(translationMemoryService.searchTransMemory(targetLocaleId, sourceLocaleId, query)).thenReturn(dummyResults);
View Full Code Here

    public Optional<HTextFlowTarget> searchBestMatchTransMemory(
            final HTextFlow textFlow, LocaleId targetLocaleId,
            LocaleId sourceLocaleId, boolean checkContext,
            boolean checkDocument, boolean checkProject) {

        TransMemoryQuery query =
                buildTMQuery(textFlow, HasSearchType.SearchType.CONTENT_HASH,
                        checkContext, checkDocument, checkProject, false);

        Collection<Object[]> matches =
                findMatchingTranslation(targetLocaleId, sourceLocaleId, query,
View Full Code Here

    public Optional<TransMemoryResultItem> searchBestMatchTransMemory(
            HTextFlow textFlow, LocaleId targetLocaleId,
            LocaleId sourceLocaleId, boolean checkContext,
            boolean checkDocument, boolean checkProject, int thresholdPercent) {

        TransMemoryQuery query =
                buildTMQuery(textFlow, HasSearchType.SearchType.FUZZY_PLURAL,
                        checkContext, checkDocument, checkProject, true);

        List<TransMemoryResultItem> tmResults =
                searchTransMemory(targetLocaleId, sourceLocaleId, query);
View Full Code Here

                        .getDocument().getDocId());
        TransMemoryQuery.Condition res =
                new TransMemoryQuery.Condition(checkContext,
                        textFlow.getResId());

        TransMemoryQuery query;
        if (searchType.equals(HasSearchType.SearchType.CONTENT_HASH)) {
            query =
                    new TransMemoryQuery(textFlow.getContentHash(), searchType,
                            project, document, res);
        } else {
            query =
                    new TransMemoryQuery(textFlow.getContents(), searchType,
                            project, document, res);
        }

        if (!includeOwnTranslation) {
            query.setIncludeOwnTranslation(false, textFlow.getId().toString());
        }
        return query;
    }
View Full Code Here

    }

    @Test
    public void basicNonPluralTMSearchTest() {
        final String searchString = "file";
        TransMemoryQuery tmQuery =
                new TransMemoryQuery(searchString,
                        HasSearchType.SearchType.FUZZY);

        List<TransMemoryResultItem> results =
                service.searchTransMemory(targetLocale.getLocaleId(),
                        sourceLocale.getLocaleId(), tmQuery);
View Full Code Here

    @Test
    public void basicPluralTMSearchTest() {
        String query1 = "One file removed_";
        String query2 = "%d";

        TransMemoryQuery tmQuery =
                new TransMemoryQuery(Lists.newArrayList(query1, query2),
                        HasSearchType.SearchType.FUZZY_PLURAL);

        List<TransMemoryResultItem> results =
                service.searchTransMemory(targetLocale.getLocaleId(),
                        sourceLocale.getLocaleId(), tmQuery);
View Full Code Here

    }

    private TransMemoryExecution createExecution(String query,
            Boolean[] checks, String[] values, int expectedSize) {

        return new TransMemoryExecution(new TransMemoryQuery(query,
                HasSearchType.SearchType.FUZZY, getCondition(checks[0],
                        values[0]), getCondition(checks[1], values[1]),
                getCondition(checks[2], values[2])), expectedSize);
    }
View Full Code Here

TOP

Related Classes of org.zanata.webtrans.shared.model.TransMemoryQuery

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.