Special Character Search - @, $,#

Wednesday, 24 January 2018 · 2 messages
NR
Navin Rawat24 Jan 2018 10:42 #
Hi Team, Could I search @, $, # by full text API of bases? I am using following query but unable to get any success:
let $query := '@'
let $options := map {
                    "mode": "any",
                    "fuzzy": "off",
                    "wildcards": true(),
                    "ordered": "false"
                }
return ft:search("database", $query, $options)
Please suggest. Regards, Navin
MS
Michael Seiferle24 Jan 2018 11:12 #
Hi Navin, these characters are not searchable by the full-text-index. @$# and other special-characters are treated as word-breakers[1] and can’t be searched for. If you ran for example the following query:
Quoted text · Navin Rawat · 1 line
> ft:tokenize("foo at bar.de#test$baz“)
You will see which tokens will be added to the full-text-index. The full-text-index is usually used to search in natural language texts, so punctuation und special characters are generally ignored. Maybe a naïve approach already helps:
Quoted text · Navin Rawat · 1 line
> db:open(‚database')//text()[contains(., "@")]/..
-- Michael Seiferle, BaseX GmbH, http://www.basexgmbh.de |-- Firmensitz: Obere Laube 73, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Tel: +49 7531 916 82 77
Quoted text · Navin Rawat · 21 lines
> Am 24.01.2018 um 10:42 schrieb Navin Rawat <nrawat2005 at gmail.com>: > > Hi Team, > > Could I search @, $, # by full text API of bases? > > I am using following query but unable to get any success: > > let $query := '@' > let $options := map { > "mode": "any", > "fuzzy": "off", > "wildcards": true(), > "ordered": "false" > } > return ft:search("database", $query, $options) > > Please suggest. > > Regards, > Navin

⚡Generated with XQuery