Complex criteria across multiple indexes (attempting LocalParamsQuery in SolrMultipleCriteriaQuery)

21 views
Skip to first unread message

Greg

unread,
Dec 31, 2016, 1:13:09 PM12/31/16
to SolrNet
Apologies for the utter newbie question. I've inherited a project that uses Solr and I'm on a steep learning curve. I cannot find my answer explicitly in documentation of SolrNet or Solr itself. I've tried to be clear on how I understand the relevant parts below but do correct me if my assumptions/understandings are just wrong.

I wish to run a query that spans 3 indexes, but i wish to use "complex" criteria.For example (much simplified):

Find all documents from mainIndex where (mainIndex contains "abc" AND childIndex1 contains "123") OR (mainIndex contains "xyz" AND childIndex2 contains "789")

If only one index were used, I'd nest these clauses in a SolrMultipleCriteriaQuery however to access another index, I believe I must use a LocalParamsQuery. Despite implementing ISolrQuery, a LocalParamsQuery cannot be nested within a SolrMultipleCriteriaQuery. The only way I can see to use a LocalParamsQuery (and therefore the only way to interrogate additional indexes) is by using a FilterQuery. A FilterQuery would not allow the complexity required in my search - as I understand it, a subset of both childIndex1 and childIndex2 would be cross-joined to the main index, effectively producing the following: 

Find all documents from mainIndex where (mainIndex contains "abc" OR "xyz") AND (childIndex1 contains "123" OR childIndex2 contains "789")

Consequently, the following false positives are returned:
 mainIndex: abc, childIndex: 789
 mainIndex: xyz, childIndex: 123

Conceptually, I believe that my "problem" would be solved by allowing a LocalParamsQuery to be nested alongside other clauses in a SolrMultipleCriteriaQuery. That this appears to be impossible suggests that I am looking to solve the problem the wrong way (coming more from a SQL background, it is clear that a Solr index and a SQL table are by no means analogous).

Can anyone steer me in the right direction?

Reply all
Reply to author
Forward
0 new messages