php8.5
Home/ Manual/ solr / solrutils/ SolrUtils::escapeQueryChars

SolrUtils::escapeQueryChars

PHP function Edit on GitHub ✎

(PECL solr >= 0.9.2)

Escapes a lucene query string

Description

SolrUtils::escapeQueryChars(string $str): string|false

Lucene supports escaping special characters that are part of the query syntax.

The current list special characters are:

+ - && || ! ( ) { } [ ] ^ " ~ * ? : \ /

These characters are part of the query syntax and must be escaped

Parameters

str

This is the query string to be escaped.

Return Values

Returns the escaped stringFalseforfailure.

Source: reference/solr/solrutils/escapequerychars.xml · from the official PHP manual (php/doc-en)