Trying to exlcude VTI* paths in MSIDXS sql select statement

Posted by Catdirt on Stack Overflow See other posts from Stack Overflow or by Catdirt
Published on 2010-04-05T15:22:44Z Indexed on 2010/04/06 19:43 UTC
Read the original article Hit count: 138

Filed under:
|
|
|

Hi, using a c# asp.net page, building a SQL query string to run against an index server catalog:

string SQL = "SELECT doctitle, vpath, Path, Write, Size, Rank ";
    SQL += "FROM \"" + strCatalog + "\"..SCOPE() ";
    SQL += "WHERE";
    SQL += " CONTAINS(Contents, '" + strQP + "') ";
    SQL += "AND NOT CONTAINS(Path, '\"_vti_\"') ";
    SQL += "AND NOT CONTAINS(FileName, '\".ascx\" OR \".config\" OR \".css\"') ";
    SQL += "ORDER BY Rank DESC"; 

Seems to work fine, except it will return results in the _vti_ directories which I am trying to avoid.

Edit: All but asked question, so to be technical: How can I search the index and have it not return files from the vti folders? Switching to use an ixsso query object is possible, but i'd rather avoid it for this particular instance.

© Stack Overflow or respective owner

Related posts about c#

Related posts about sql