Soham Nakhare
Soham Nakhare

Reputation: 423

Solr search with a single round bracket not working

I am new to Solr.

I am trying to search for records containing single round bracket either '(' or ')'.

The query for searching the record is as follows:

q=( ( name: (*\(abc*) ) )

The above query breaks the solr search.

I am escaping the ( ) character by using the following regex:

value = value.replace(/([()])/g, '\\$1');

Can someone please help to troubleshoot this issue ?

Upvotes: 0

Views: 1387

Answers (1)

Persimmonium
Persimmonium

Reputation: 15791

I am not very good with the regex so I cannot discern what is happening there, but this solr query should work:

q=name:*\(abc*

does it no?

As you can see in the lucene doc, the only char to escape in your query is (. ) would need to be escaped too if you search for it. But I understand in your example all the ) are just part of the language.

Upvotes: 2

Related Questions