Using DomInstanceExposers.FieldValues.DomInstanceField(fieldId).Contains(searchValue) returns unexpected results. The filter appears to perform fuzzy/tokenized matching rather than exact substring matching.
Environment:
- DataMiner 10.5.0.0-16432-CU8
Code:
var customerNameFieldId = GetFieldDescriptorId("Customer Name");
var definitionFilter = DomInstanceExposers.DomDefinitionId.Equal(domDefinition.ID.Id);
var customerNameFilter = DomInstanceExposers.FieldValues.DomInstanceField(customerNameFieldId).Contains("00000000");
var combinedFilter = new ANDFilterElement<DomInstance>(definitionFilter, customerNameFilter);
var instances = DomHelper.DomInstances.Read(combinedFilter); // Returns 2646 instances
Result:
- Search value: "00000000"
- Expected: 0 results (no CustomerName contains this string)
- Actual: 2646 results
Verified by logging actual field values - none contain "00000000":
CustomerName: 'MBC FZ LLC - 110004' - Contains '00000000': False
CustomerName: 'MBC FZ LLC - 110002' - Contains '00000000': False
CustomerName: 'MX1 Internal - MX1Internal0000' - Contains '00000000': False
...
Questions:
1. Is Contains performing tokenized matching in OpenSearch rather than exact substring matching (like SQL LIKE '%value%')?
2. Is there an alternative filter for exact substring matching at database level?
3. Is this expected behavior or a bug?
Current workaround: Post-filtering in memory with LINQ .Where(), but this impacts performance on large datasets.
Great question – won't post an answer as I haven't played much with OpenSearch yet, but based on the output above, I'd say you're right and that Contains(…)-based DOM filter behaves like a tokenized search rather than a SQL LIKE '%value%'
So 1 & 3 would seem by design:
ref 2, unsure – have you tried a "term" query?
https://docs.opensearch.org/1.1/opensearch/query-dsl/term/#term
Subscribing to get an insight from more experienced users.