Hi guys, I'm running some tests and I can't see to figure this one out. Suppose we have a real estate index, containing homes for rent and purchase. The first kind of query I want to make is like so: - type:purchase AND {!frange u=10}mycustomfunction()
The function is expensive and, in order to improve performance, I want it to be applied only on the subset of documents that match type:purchase. Using: q=*:*&fq={!cost=1}type:purchase&{!frange u=0 cost=3}mycustomfunction() The function is applied on all documents, instead of only those that match the *purchase* type. I verified this assumption, by checking the query time and also by debugging the custom function. So after reading more, I found the post-filters feature that exists in SOLR. This is activated when the cost>=100 and cache=false. This lead me to the following query: q=*:*&fq={!cost=1}type:purchase&{!frange u=0 cost=150 cache=false}mycustomfunction() This works beautifully, with the function being applied on only the subset of documents that match the desired type. Now, if I want to make a query that also contains some OR, it is impossible to do so with this approach. This is because fq with OR operator is not supported (SOLR-1223). As an alternative I've tried these queries: county='New York' AND (location:Maylands OR location:Holliscort or parking:yes) AND_val_:"{!frange u=0 cost=150 cache=false}mycustomfunction()" county='New York' AND (location:Maylands OR location:Holliscort or parking:yes) AND {!parent which=' {!frange u=0 cost=150 cache=false}mycustomfunction()'} On both these queries, the function is applied on all the documents that exist in the index, instead of at least limiting to those homes that are in New York. I've also tried with different cost/cache params. Is there any way I can achieve queries containing AND/OR operators and a custom function being applied on only the subset of documents that match the previously query parts? Thanks, Costi