Query Regarding Full Text Search | Community
Skip to main content
Level 2
September 12, 2020
Solved

Query Regarding Full Text Search

  • September 12, 2020
  • 2 replies
  • 2828 views

Hi All,

 

Is there any way to make use of non english words like "español" as fulltext in Querybuilder  API?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by ChitraMadan

Hi @binoyp,

 

Full text search will be able to find español in the content irrespective of language. Please see below OOTB groovy script which is able to find all the references of español in the content

 

def predicates = [
"path": "/content",
"fulltext": "español"
]

def query = createQuery(predicates)

query.hitsPerPage = 10

def result = query.result

println "${result.totalMatches} hits, execution time = ${result.executionTime}s\n--"

result.hits.each { hit ->
println "hit path = ${hit.node.path}"
}

 

Please check if UTF-8 is enabled in Apache Sling Request Parameter Handling configuration.

2 replies

Singaiah_Chintalapudi
Level 7
September 12, 2020

The QueryBuilder works on the given predicates. If you're using non-english words and searching in those specific locales, it should work. For example: searching "español" in /content/yourproject/es/*.

 

What problem are you facing or whats the requirement?

 

Thanks,

Singaiah

binoypAuthor
Level 2
September 13, 2020
Hi Singaiah, the exact doubt is that when i try passing the fulltext as a parameter in a querybuilder servlet for searching the pages. These special characters throw a bad request error . How can we work around this.
ChitraMadan
Community Advisor
ChitraMadanCommunity AdvisorAccepted solution
Community Advisor
September 12, 2020

Hi @binoyp,

 

Full text search will be able to find español in the content irrespective of language. Please see below OOTB groovy script which is able to find all the references of español in the content

 

def predicates = [
"path": "/content",
"fulltext": "español"
]

def query = createQuery(predicates)

query.hitsPerPage = 10

def result = query.result

println "${result.totalMatches} hits, execution time = ${result.executionTime}s\n--"

result.hits.each { hit ->
println "hit path = ${hit.node.path}"
}

 

Please check if UTF-8 is enabled in Apache Sling Request Parameter Handling configuration.

binoypAuthor
Level 2
September 13, 2020
Hi Chitra, the exact doubt is that when i try passing the fulltext as a parameter in a querybuilder servlet for searching the pages. These special characters throw a bad request error . How can we work around this.