This project has moved. For the latest updates, please go here.

When column is "indexed" cannot GetListItems using Lookup field in query

Sep 30, 2014 at 1:28 PM
I have been running around in circles trying to figure out why one of my lists wouldn't pull any results when querying based on a Lookup value. When I disabled indexing on the lookup column it suddenly worked!

Is this behavior expected (that is, do other's experience it) and is there a workaround or should I explore more why my query isn't working? I'm using SP2007.

Here is my query code (note if I change this query to a non-indexed field or if I use the exact same query but turn off the index it works):
  var langaugeID = 26;
  var colLangName = 'Language';
  var query =  '' +
    '<Query>' +
      '<Where>' +
            '<Eq>' +
              '<FieldRef Name="' + colLangName + '" LookupId="TRUE" />' +
              '<Value Type="Lookup">' + languageID + '</Value>' +
            '</Eq>' +
      '</Where>' +
Oct 6, 2014 at 5:53 PM
I've never seen indexing make any difference, but then again, I don't usually index columns because it doesn't really buy you much.