lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Kirk ...@alpha-solutions.dk>
Subject if exists in an fq
Date Tue, 12 Sep 2017 21:05:34 GMT
Hi

I want to formulate an fq which filters on fields depending on what fields exist in each document.

For example:
if the document has a "field1" then use "field1:[1 TO 100]";
but if there is no "field1", then check if there is a "field2";
if there is a "field2" then use "field2:[1 TO 100];
but if there is no "field2", then use "field3:[1 TO 100].

Something like:
?q=*:*&fq=if(exists(field1),field1:[1 TO 100],if(exists(field2),field2:[1 TO 100], field3:[1
TO 100]))


But is this does not work.
Is it even possible?

Thanks,
Peter
Mime
View raw message