Special Character Search - @, $,#
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
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(., "@")]/..
Best from Konstanz,
Michael
[1] https://www.w3.org/TR/xpath-full-text-10/ <https://www.w3.org/TR/xpath-full-text-10/>
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
Written for BaseX 8.6. BaseX may have changed since: please check the current documentation.