Examine find results where 2 out of 3 fields match
I want to search the Umbraco Members to find records that match on at least 2 out of 3 fields.
For example, if I have FieldA, FieldB and FieldC - I want to create a search that supplies values for all 3 fields (but the value may be "") and I want to find records where at least 2 of those fields match the provided values.
Is this something that Examine can do natively, or do I need to do an "Or" search and find the "2 out of 3" matches myself?
the 3 fields are part of the index, that's not the problem. I want to return results where at least two of the fields match, or all three ... but not where just one matches.
So, where:
FieldA and FieldB
or FieldA and FieldC
or FieldB and FieldC
etc
I was wondering if the examine score would help me but it's value looks too complicated to figure out!
It would be good if I could have a "value" field that was "1" if only one field matched, "2" for two fields matching and "3" for three fields matching.
I was hoping that there was some way to do this with the Examine search, rather than having to get all the results back and filtering them using C#.
Examine find results where 2 out of 3 fields match
I want to search the Umbraco Members to find records that match on at least 2 out of 3 fields.
For example, if I have FieldA, FieldB and FieldC - I want to create a search that supplies values for all 3 fields (but the value may be "") and I want to find records where at least 2 of those fields match the provided values.
Is this something that Examine can do natively, or do I need to do an "Or" search and find the "2 out of 3" matches myself?
Hi Gordon
It looks like you just need to change index configuration, just add your fields to Examine index, it should be enough for this functionality.
Thanks,
Alex
Hi Alex,
the 3 fields are part of the index, that's not the problem. I want to return results where at least two of the fields match, or all three ... but not where just one matches.
So, where:
FieldA and FieldB
or FieldA and FieldC
or FieldB and FieldC
etc
I was wondering if the examine score would help me but it's value looks too complicated to figure out!
It would be good if I could have a "value" field that was "1" if only one field matched, "2" for two fields matching and "3" for three fields matching.
I was hoping that there was some way to do this with the Examine search, rather than having to get all the results back and filtering them using C#.
OK, by testing with the query tool in Umbraco Developer section, I think I need a query like this:
So - how do I create that with FluentAPI?!!
is working on a reply...