Hello I am searching for a way to specify optional terms in a query ( that dont need to match (But if they match should influence the scoring) )
Using the dismax parser a query like this: <str name="mm">2</str> <str name="debugQuery">on</str> <str name="q">+lorem ipsum dolor amet</str> <str name="qf">content</str> <str name="hl.fl"/> <str name="qt">dismax</str> Will be parsed into something like this: <str name="parsedquery_toString"> +((+(content:lor) (content:ipsum) (content:dolor) (content:amet))~2) () </str> Which will result that only 2 of the 3 optional terms need to match? How can optional terms be specified using the standard request handler? My concrete requirement is that a certain term should match but another is optional. But if the optional part matches - it should give the document an extra score. Something like :-) <str name="q">content:lorem #optional#content:optionalboostword^10</str> An idea would be to use a function query to boost the document: <str name="q"> content:lorem _val_:"query({!lucene v='optionalword^20'})" </str> Which will result in: <str name="parsedquery_toString"> +content:forum +query(content:optionalword^20.0,def=0.0) </str> Is this a good way or are there other suggestions? Thanks for any opinion and tips on this Daniel