Search is made segment-by segment, and it's checking segment if it fits selected filters. You can search for EXACT or CONCORDANCE matches in this fields:
source, target, document, author, addInfo, context
To set filter, use it's SearchMode field, otherwise filter would be disabled. So you have sourceSearchMode, targetSearchMode, documentSearchMode,
authorSearchMode, addInfoSearchMode, contextSearchMode
Search mode should be set explicitly to CONTAINS/CONCORDANCE or EXACT, otherwise filter would be ignored. But also each searchMode could have additional search parameters "CONTAINS, caseinsensetive, WHITESPACETOLERANT, INVERTED", all that values is not important, as well as delimiter. By default search is case sensetive. If you add Inverted option, check for that filter would be reverted.
To check how filters would be parsed, check json in responce. Field with that info could look like this:
"Filters":"
Search filter, field: SOURCE FilterType::CONTAINS SearchStr: 'THE'; Options: SEARCH_FILTERS_NOT|SEARCH_CASEINSENSITIVE_OPT|SEARCH_WHITESPACETOLERANT_OPT|;\n
Search filter, field: TARGET FilterType::EXACT SearchStr: ''; Options: SEARCH_CASEINSENSITIVE_OPT|;\n
Search filter, field: ADDINFO FilterType::CONTAINS SearchStr: 'some add info'; Options: SEARCH_WHITESPACETOLERANT_OPT|;\n
Search filter, field: CONTEXT FilterType::EXACT SearchStr: 'context context'; Options: ;\nSearch filter, field: AUTHOR FilterType::CONTAINS SearchStr: ''; Options: ;\n
Search filter, field: DOCUMENT FilterType::CONTAINS SearchStr: 'evo3_p1137_reports_translation_properties_de_fr_20220720_094902'; Options: SEARCH_FILTERS_NOT|;\n
Search filter, field: TIMESTAMP FilterType::RANGE Range: 20000121T115234Z - 20240121T115234Z Options: ;\n",
It's possible to apply filter just with SearchMode, like if you would type "authorSearchMode": "exact",but there would be no "author" field, it would look for segments, where author field is empty.
Also there are timespan parameter, to set it, use this fields and format:
"timestampSpanStart":"20000121T115234Z",
"timestampSpanEnd":"20240121T115234Z",
You should set both parameters to apply filter, otherwise you would get error as return. Check output to see how it was parsed and applied.
By default all mentioned filters is applied in logical and combination, but you can change that globaly with adding
"filtersCombinedAs":"or",
Then all mentioned filters would be applied in logical or combination.
Also there are lang filters, they would always be applied to selection of segments that passed previous filters, so value of filtersCombinedAs wouldn't be applied to that.
To set language filters, use this fields:
"sourceLang":"en-GB",
"targetLang":"de",
Lang filters could be applied with major lang feature, so source lang in this case would be applied as exact filter for source lang, but target lang would check if langs is in the same lang group. That check is done in languages.xml file with isPreferred flag.
Lang filters and if filters is combined in logical or or logical and you can check in GlobalSearchOptions field of responce. It could look like this:
"GlobalSearchOptions":"SEARCH_FILTERS_LOGICAL_OR|SEARCH_EXACT_MATCH_OF_SRC_LANG_OPT, lang = en-GB|SEARCH_GROUP_MATCH_OF_TRG_LANG_OPT, lang = de",
Other that you can send is:
"searchPosition":"8:1",
"numResults":2,
"msSearchAfterNumResults":250
"loggingThreshold": 4 - check other requests,
So search position is position where to start search internaly in btree. This search is limited by num of found segment(set by numResults) or timeout(set by msSearchAfterNumResults), but timeout would be ignored in case if there are no segments in the tm to fit params. Max numResults is 200.
You can send empty json and search would work fine, but it would just return first 5 segments in tm
You can go through all segment with using this 2 fields
"searchPosition":"8:1",
"numResults":200
and just updating searchPosition with NewSearchPositionfrom responce. Code Block |
---|
language | js |
---|
title | Response |
---|
collapse | true |
---|
|
{
"filtersCombinedAs": "or",
"source":"the",
"sourceSearchMode":"CONTAINS, CASEINSENSETIVE, WHITESPACETOLERANT, INVERTED",
"target":"",
"targetSearchMode":"EXACT, CASEINSENSETIVE",
"document":"evo3_p1137_reports_translation_properties_de_fr_20220720_094902",
"documentSearchMode":"CONTAINS, INVERTED",
"authorSearchMode":"CONTAINS",
"timestampSpanStart": "20000121T115234Z",
"timestampSpanEnd": "20240121T115234Z",
"addInfo":"some add info",
"addInfoSearchMode":"CONCORDANCE, WHITESPACETOLERANT",
"context":"context context",
"contextSearchMode":"EXACT",
"sourceLang":"en-GB",
"targetLang":"SV",
"searchPosition": "8:1",
"numResults": 2,
"msSearchAfterNumResults": 25
}
So here search would be done in logical or way, so if any of source, target, document, context, author, timestamp filters returns true, result would be added to set, which then would be filtered out by sourceLang on exact match check and targetLang on groupLang check.
Search would start from position "8:1"(tm data start at "7:1" but if you wan't to start from the beggining, just avoid that param.
numResuts:2 - so if there would be 2 segments found, search would end
"msSearchAfterNumResults": 25 - 25ms after first found segment, search would end, even if more segments was found, responce would contain "NewSearchPosition": "10:1", which can be used in searchPosition to continue search
Response example:Success:
example{
"Filters": "Search filter, field: SOURCE FilterType::CONTAINS SearchStr: 'THE'; Options: SEARCH_FILTERS_NOT|SEARCH_CASEINSENSITIVE_OPT|SEARCH_WHITESPACETOLERANT_OPT|;\ |