(:
Thanks Christian ... I had to write this out to understand it better I have basic understanding of what you are saying. I will read >> https://www.w3.org/TR/xpath-full-text-10/#ftwildcardoption. It looks flexible
https://www.w3.org/TR/xpath-full-text-10/#ftdistance
'exactly 0' specifies the range [0, 0]. 'at least 1' specifies the range [1,unbounded). 'at most 1' specifies the range (unbounded, 1]. 'from 5 to 10' specifies the range [5, 10].
ftor : An or-selection finds all matches that satisfy at least one of the operand full-text selections. 4.2.6.1 FTOr ftand ...https://www.w3.org/TR/xpath-full-text-10/#tq-ft-fs-FTAnd 4.2.6.2 FTAnd
?? [146] FTOr ::= FTAnd ( "ftor" FTAnd )* [147] FTAnd ::= FTMildNot ( "ftand" FTMildNot )* [148] FTMildNot ::= FTUnaryNot ( "not" "in" FTUnaryNot )* [149] FTUnaryNot ::= ("ftnot")? FTPrimaryWithOptions
:)
let $a := 'A B' contains text { 'A', 'B' } all distance at most 0 words let $b := 'A B' contains text { 'A', 'B' } all distance at most 1 words let $c := 'A B' contains text { 'A', 'B' } all distance at most 2 words let $d := 'A C B' contains text { 'A', 'B' } all distance at most 0 words let $e := 'A C B' contains text { 'A', 'B' } all distance at most 1 words let $f := 'A C B' contains text { 'A', 'B' } all distance at most 2 words let $g := 'A C B' contains text { 'A', 'B' } all distance at most 3 words
let $h := 'A x B' contains text 'A B' all distance at most 1 words let $i := 'A x B' contains text 'A B' all words distance at most 1 words let $j := 'A x B x x B' contains text { 'A', 'B' } all distance at most 1 words let $k := 'A x B x x B' contains text 'A' ftand 'B' all words distance at most 1 words
return <x>{for $w at $pos in ($a,$b,$c,$d,$e,$f,$g,$h,$i,$j,$k) return element {fn:codepoints-to-string(fn:string-to-codepoints('a')+ $pos - 1)} {$w} }</x>
(:
This query returns true: 'A x B' contains text { 'A', 'B' } all distance at most 1 words === true => the distance of seperation is !=0, ==1, at most (>=1) words => I understand
The following query returns false because 'A B' is treated as a single search term: 'A x B' contains text 'A B' all distance at most 1 words === false => I understand
The following query returns true. It’s actually equivalent to the first query: Due to “all words”, the single string will be tokenized into independent search terms. => the query is not specified in the email I am guessing the query was i) above (with all words): 'A x B' contains text 'A B' all words distance at most 1 words Specification ?If FTAnyallOption is "all words", the tokens from all the strings are combined into a single set. If the set is empty, the FTWords yields no matches. The resulting matches must contain all of the tokens in the set.
Things get freaky with the next use case: 'A x B x x B' contains text { 'A', 'B' } all distance at most 1 words === false The query creates three string matches: 1 for “A” and 2 for ”B”. The specification states: “When a distance selection applies a distance condition to more than two matches, the distance condition is required to hold on each successive pair of matches.” [1]. In our case, the rule does not hold on the last pair (the distance between “B” and “B” is too large). =>Yes this is freaky .. I understand because the distances of B(first) from A is 1 word but B(second) from A is 4 words =>instead of 'at most' there possibly could be a 'within' option ...
These are the DTSearch Options - they can be combined into a boolean expression but clearly are not as flexible (eg FTTimes)
https://support.dtsearch.com/webhelp/dtsearchCppApi/Boolean_Search_Requests.... Search Request Explanation apple and pear -Both words must be present. apple or pear -Either word can be present. apple w/5 pear -Apple must occur within 5 words of pear. apple pre/5 pear -Apple must occur 5 or fewer words before pear. apple not w/5 pear -Apple must not occur within 5 words of pear. apple and not pear -Only apple must be present. name contains smith -The field name must contain smith apple w/5 xfirstword -Apple must occur in the first five words. apple w/5 xlastword -Apple must occur in the last five words.
There are also nested fields that can be built into a boolean search ... https://support.dtsearch.com/webhelp/dtsearch/field_searching.htm /record//city contains Middleton
I will read https://www.w3.org/TR/xpath-full-text-10/#ftwildcardoption and basex. It confusing to me but seems super flexible.
'A x B x x B' contains text 'A' ftand 'B' all words distance at most 1 words === true This query will return two “full-text matches”, each containing two “string matches”, and the check will be successful if at least one full-text match is successul. In this case, it’s the first full-text match, which contains string-matches for “A” and “B”, which are at most one word distant from each other.
=> It is great that it works. I add this to my memory banks and will push on - thanks again this is all much appreciated.
:)