If you index the literal string value of "[ DATA ]" and then you wnat to be able to query for "[ DATA ]" again later there are two things you have to consider:
1) how is your field value analyzed? If you use something like StrField then an index term for the literal string "[ DATA ]" is created and put in your index, but if you use TextField then the analyzer configured might do things like tokenize the string into 3 distinct terms, lowercase alpha charagers, or perhaps even drop the bracket characters completely -- as long as that is consistent at index time and query time then you should be fine, as long as you pay attention to... 2) what query parser are you using. The default parser treats brackets and whitespace as special meta-syntax characters. You can quote them, or backslah escape them but the whitespace itself may also need to be quoted/escaped to prevent the parser from trying to make a boolena query for 3 terms ("[", "DATA", "]") instead of 1. alternatively you can use things like the "field" QParser, which let's you target a specific field by name, with a query string value that can be anything -- there are no special meta-syntax characters for hte field parser. and the appopriate analyer wll be used to create a TermQuery or PhraseQuery (as needed) ie: q = {!field f=your_field_name}[ DATA ] https://cwiki.apache.org/confluence/display/solr/Other+Parsers : Date: Tue, 5 Jul 2016 08:45:57 +0530 : From: Anil <anilk...@gmail.com> : Reply-To: solr-user@lucene.apache.org : To: solr-user@lucene.apache.org : Subject: Re: Index and query brackets : : NO Ediwin. Thanks for your response. : : i was checking how to check [1 TO 5] as a content not as a range query. : : i tried by escaping [ and ] and did not work. seems need to check analyzers : at index side. : : Regards, : Anil : : On 5 July 2016 at 08:42, Zheng Lin Edwin Yeo <edwinye...@gmail.com> wrote: : : > Hi Anil, : > : > Are you referring to something like q=level:[1 TO 5] ? This will search for : > level that ranges from 1 to 5. : > You may refer to the documentation here: : > https://wiki.apache.org/solr/SolrQuerySyntax : > : > Regards, : > Edwin : > : > : > On 4 July 2016 at 15:05, Anil <anilk...@gmail.com> wrote: : > : > > HI, : > > : > > how can index and query content with brackets as bracket is used for : > range : > > query : > > : > > Ex : [DATA] : > > : > > - : > > Anil : > > : > : -Hoss http://www.lucidworks.com/