You've asked this question several times w/o really providing a clear concrete set of examples of what you are trying to do ... in several of your duplicated threads, people have suggested using hte switch qparser, and you've dismissed that suggestion for various reasons that you also haven't fully explained.
Here now you've provided an example of what kind of syntax you seem to want to support (w/o really going into full details of how you wnat it to behavave in various edge cases) but it doesn't really make sense to me for a variety of reasons... 1) you've said your "optional" parser shouldn't throw an error if the input variable is not specified, but you haven't said what you do want it to do instead ... match all docs? match no docs? ... this detail matters a lot, especially when you embed it in a nested boolena query like your example 2) assuming you want to match all docs when the variable isn't specified, then your "optional" example seems to directly match the simplest usecase of the switch parser... a) add an invariant that handle the parser options that you want to use when the variable ($where) is specified) ... <str name="where_clause"> ( _query_:"{!dismax df='addr' qs=1 v=$where}"^6.2 OR _query_:"{!dismax df='addr_i' qs=1 v=$where}"^6.2 ) </str> b) use our variable as the 'default' in a switch parser instance, and specify case='*:*' to match all docs when the variable isn't specified... {!switch case=*:* default=$where_clause v=$where} 3) unrelated to your question, the example you've provided makes very little sense to me because of how you are using the dismax parser with only a single field in the "qf", but then combining multiples instances (with diff fields and diff boosts but the same query string) using a wrapper query. i suspect that in general what you really want instead of things like this... ( _query_:"{!dismax qf=person_name v=$fname}"^3.9 OR _query_:"{!dismax qf=name_phonetic_i v=$fname}"^0.9 OR ) ...is sometihng like this... _query_:{!dismax tie=1.0 qf='person_name^3.9 name_phonetic_i^0.9 v=$fname}" : Date: Mon, 15 Jul 2013 09:24:56 -0700 (PDT) : From: SolrLover : Subject: Re: How to pass null OR empty values to fq? : : Jack, : : First, thanks a lot for your response. : : We hardcode certain queries directly in search component as its easy for us : to make changes to the query from SOLR side compared to changing in : applications (as many applications - mobile, desktop etc.. use single SOLR : instance). We don't want to change the code which forms the query every time : the query changes rather just changing the query in SOLR should do the : job...Search team controls the boost and other matching criteria hence : search team changes the boost more often without affecting the : application...Now whenever a particular value is not passed in the query, we : are trying to do a pass through so that the entire query doesn't fail (we : pass through only when the custom plugin is used along with the query - for : ex: !optional is the custom plugin that shouldn't throw any error if a value : for any particular variable is not present)... : : <requestHandler name="find" class="solr.SearchHandler" default="true"> : <str name="q"> : ( : _query_:"{!dismax qf=lname_i v=$lname}"^8.3 OR : _query_:"{!dismax qf=lname_phonetic v=$lname}"^8.6 : ) : ( : _query_:"{!optional df='addr' qs=1 v=$where}"^6.2 OR : _query_:"{!optional df='addr_i' qs=1 v=$where}"^6.2 : ) : ( : _query_:"{!dismax qf=person_name v=$fname}"^3.9 OR : _query_:"{!dismax qf=name_phonetic_i v=$fname}"^0.9 OR : ) : : </str> : </> : : : : -- : View this message in context: http://lucene.472066.n3.nabble.com/Re-How-to-pass-null-OR-empty-values-to-fq-tp4078085p4078094.html : Sent from the Solr - User mailing list archive at Nabble.com. : -Hoss