Mapping query-params to $options argement of ft:functionj

Monday, 28 September 2020 · 4 messages · last reply 5 Oct 2020
GD
Günter Dunz-Wolff28 Sep 2020 11:06 #
Hi all, is there a possibility to match the query-parameters more directly to the $options argument of a ft:function? In the moment I have a rather complicated if-else-if-else-if…-scenario. Example: if ($wildcards = "on" and $all = "on" and $case_sensitive = "on" and $using_diacritics = "on") then $collection[.//text() contains text {$query} all words using case sensitive using diacritics sensitive using wildcards] else if and so on. Depending on query-params I want to build the ft:function with $options argument more directly. (But for example string-concatenation doesn’t work.) Thanks for any advice. Guenter
CG
Christian Grün5 Oct 2020 09:29 #
Hi Günter, The function ft:search [1] was added to BaseX to fill this shortcoming of the official spec. Hope this helps Christian [1] https://docs.basex.org/wiki/Full-Text_Module#ft:search
Quoted text · Günter Dunz-Wolff · 16 lines
On Mon, Sep 28, 2020 at 11:06 AM Günter Dunz-Wolff <guenter.dunzwolff at gmail.com> wrote: > > Hi all, > is there a possibility to match the query-parameters more directly to the $options argument of a ft:function? In the moment I have a rather complicated if-else-if-else-if…-scenario. > > Example: > if ($wildcards = "on" and $all = "on" and $case_sensitive = "on" and $using_diacritics = "on") then $collection[.//text() contains text {$query} all words using case sensitive using diacritics sensitive using wildcards] else if and so on. > > Depending on query-params I want to build the ft:function with $options argument more directly. (But for example string-concatenation doesn’t work.) > > Thanks for any advice. > > Guenter > >
GD
Günter Dunz-Wolff5 Oct 2020 10:03 #
Hi Christian, thanks for your help. Is there a way to combine ft:search with ft:mark, cause at the end I need the results marked. Kind regards Guenter
Quoted text · Christian Grün · 31 lines
> Am 05.10.2020 um 09:30 schrieb Christian Grün <christian.gruen at gmail.com>: > > Hi Günter, > > The function ft:search [1] was added to BaseX to fill this shortcoming > of the official spec. > > Hope this helps > Christian > > [1] https://docs.basex.org/wiki/Full-Text_Module#ft:search > > > > >> On Mon, Sep 28, 2020 at 11:06 AM Günter Dunz-Wolff >> <guenter.dunzwolff at gmail.com> wrote: >> >> Hi all, >> is there a possibility to match the query-parameters more directly to the $options argument of a ft:function? In the moment I have a rather complicated if-else-if-else-if…-scenario. >> >> Example: >> if ($wildcards = "on" and $all = "on" and $case_sensitive = "on" and $using_diacritics = "on") then $collection[.//text() contains text {$query} all words using case sensitive using diacritics sensitive using wildcards] else if and so on. >> >> Depending on query-params I want to build the ft:function with $options argument more directly. (But for example string-concatenation doesn’t work.) >> >> Thanks for any advice. >> >> Guenter >> >>
CG
Christian Grün5 Oct 2020 15:18 #
Quoted text · Günter Dunz-Wolff · 1 line
> thanks for your help. Is there a way to combine ft:search with ft:mark, cause at the end I need the results marked.
Yes, you can combine ft:search and ft:mark. Try e.g. the following query:
  ft:mark(ft:search('db', 'term')/..)

⚡Generated with XQuery