I have a setup in which I have two indexes in solr: product_code and title. product_code uses a StrField and title uses a TextField with DoubleMetaphone.
I have a single search box for users to type in either a product code or free text for a title search. I'm currently using dismax and doing qf=product_code title. The problem I have is that very often a product code (e.g. LC12345) might match a word in the title once the DoubleMetaphone has been applied.
So what I want to do is construct a query in such a way that it first applies the query term to the product_code index and only if there are no matches then apply the query term to the title index. Is there a way of doing this without having to do two separate queries to Solr? This is for an AJAX 'live search' so I want to keep latency to a minimum so don't want to have to do two separate queries to Solr.
-Matt