lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Neil Prosser <neil.pros...@gmail.com>
Subject DisMax search on field only if it exists otherwise fall-back to another
Date Thu, 15 Jan 2015 15:17:04 GMT
Hopefully this question makes sense.

At the moment I'm using a DisMax query which looks something like the
following (massively cut-down):

?defType=dismax
&q=some query
&qf=field_one^0.5 field_two^1.0

I've got some localisation work coming up where I'd like to use the value
of one, sparsely populated field if it exists, falling back to another if
it doesn't (rather than duplicating some default value for all territories).

Using the standard query parser I understand I can do the following to get
this behaviour:

?q=if(exist(field_one),(field_one:some query),(field_three:some query))

However, I don't know how I would go about using DisMax for this type of
fallback.

Has anyone tried to do this sort of thing before? Is there a way to use
functions within the qf parameter?

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message