lucene - Solr: how to mark the query conditions matched in the result -


My solr implementation is something like this

q = (field 1: ipod and field 2: black) or (field 3: 'apple computer') or (field 4: working)

Essentially 3 positions are divided by 'o' when I run this query, then I Results. In the results I want to see which 3 of the conditions were met. For example, in addition to returned data (custom fields), especially I would like cond1 = true, cond2 = true, cond3 = false for each document.

Assume that there will be no analysis on these areas (1 to 4). All field strings are Solar 4.6.1 delivered.

Solution (but without satisfactory consequences):

  1. Debugquiry = seems really important information (to explain the field), that I am not interested in it, I I want to add simple fields. I can get this debug XML-Iced for parsing, but it is complicated for normal processing.
  2. The Group Group (Group.quiry) option will assist in providing conditions in the group. So that we can group it on the basis of conditions, not the best option for me, but just tried it but it does not seem to work in the distributed mode (SOLR-5046)
  3. field By adding a function query, the same field is not able to perform string equivalent tests like _cond1_: if (field1 == 'ipod' and field2 == 'black'). There is no similarity check in the function query that I think.

Is there another alternative solution here? Should I Write Custom Equality or Custom Doctor Transformer here?

Code> ultimate:

  fl = *, firstmatch: if (and (wordfreak (field 1, 'ipod'), wordfrack (field 2, 'black')) 1,0), Secondmatch: If (Termfreak (Field 3, 'Apple Computer')), 1.0, Third Member: if (Term 4, 'Work'), 1.0)  < / Pre> 

(New lines are only for clarity)

You must give three fields with 1 or 0 for the match.

The original idea is that you can use the function query in the fl field to get the specific value name first mache , secondsmatch and third match are just nicknames.

BTW, Since you mention all your fields are strings, you'll need an exact match everywhere.