[SERVER-34168] Compound textual index with nested fields does not return data Created: 28/Mar/18  Updated: 23/Apr/18  Resolved: 28/Mar/18

Status: Closed
Project: Core Server
Component/s: Text Search
Affects Version/s: 3.4.14
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Cheng [X] Assignee: Kelsey Schubert
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-27392 text index with multi-key prefix is n... Closed
Operating System: ALL
Steps To Reproduce:

Query:
find({"grades.levels" : {$in : [1]}, $text: {$search: "123"}} )

Data model:
{ "fileName" : "123", "grades" :

{ "levels" : [1, 2, 3] }

}

Non-working index: (not returning anything)

{ "fileName" : "text", "grades.levels" : 1}

Working index:

{ "fileName" : "text", "grades" : 1}
Participants:

 Description   

When I have a compound textual index with a nested field, my query does not return any expected data (not just not using the index)



 Comments   
Comment by Kelsey Schubert [ 28/Mar/18 ]

Hi cchenSmarttech,

Thank you for reporting this behavior. Please note that compound text indexes do not support multikey fields. In SERVER-27392, we strengthened the protections against creating these types of indexes to prevent their use. I have confirmed in 3.6.3, it is not possible to create the non-working index in your example. In this case, I'd suggest simply using a $text index without any other fields since the grades suffix in your working index isn't being used to satisfy the query.

Kind regards,
Kelsey

Generated at Thu Feb 08 04:35:47 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.