Our team was testing a custom SharePoint app that had some recent modifications made to it and we were finding that it wasn’t returning results that we were expecting – and had in the past. The programmer couldn’t find any unexpected changes in the CAML queries that were being used in the code. We were all struggling trying to figure out what was going on.
I was doing some troubleshooting by creating views in SharePoint on the offending libraries to filter the items we were looking for and I found that some of these views weren’t functioning correctly. One of the things I noticed when creating some views of the libraries that were giving us the problems was there were some SharePoint “indexes” defined on a couple of the fields.
For those not familiar with SharePoint indexes, they are not true relational indexes that you would create in a SQL database. Instead, they involve some clever joins to supposedly increase the performance of list views.
I found that, at some point in time, we had created some of these indexes. When creating the view in SharePoint, you could see the fields that had indexes defined because they had the word (Indexed) next to them. Trying to filter on these fields was giving us unexpected results. In fact, in one of my test cases, the filter wasn’t working at all and no results were being returned.
To solve this problem all I did was turn off the indexing on the fields in SharePoint (under library settings). After that, the filters in the views started working. Plus, in our application, we began getting the results we expected. Problem solved!