0
votes

when i run the below query i am getting results

/select?q=:&fq=%28category_name:Business%20OR%20job_name:abcdefgh%29&debugQuery=true

but When run the below query select?q=:&fq=%28category_name:Business%20dev%20OR%20job_name:abcdefgh%29&debugQuery=true

results are not coming and it shows the following error

"msg": "undefined field text", "code": 400

the only difference between the two queries is in the first query there is no space in the category_name key but in the second query there is space in it .

i think it causes an issue. please post your suggestions

1

1 Answers

0
votes

When there is no field name present, the default search field is used. By default, this is _text_ or text. In your query:

category_name:Business dev

.. this is NOT parsed as "search for the value Business dev in category_name", but it's parsed as "search for the value Business in category_name and dev in the default search field (which seems to be text in your case).

You fix this by properly escaping the space:

category_name:Business\ dev

.. or by using a phrase query:

category_name:"Business dev"

The special characters that needs escaping (as they have specific meaning in a query) is:

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

.. as well as whitespace. This should be handled automagically by your Solr library.