Windows search indexed files OLE DB search with like instead of contains

Brian Michelson 1 Reputation point
2022-06-17T10:12:17.037+00:00

So I have the problem that I need to exchange this contains, with a like in my querry. Because when you searche with a dash in a word so "12-0430-1" then the contains produces results that also contain only 12 or 0430 or 1. This is intended and also spoken about by microsoft here. Also the solution is in this article, but sadly only in a way that does not help. The solution is to exchange contains with like, but I always get an error with this edited querry:

SELECT TOP 2000 System.FileName FROM systemindex WHERE DIRECTORY = 'C:\Path...' AND (System.FullText Like ('%12-0430-1%')) ORDER BY System.DateCreated DESC

The error says because the column does not exist, but for OLE DB search I only found this older site witch specefies which columns can be searched. Before I did not need it because I used contains:

Ole-DB Querry: for 22-0130-1 SELECT TOP 2000 System.FileName FROM systemindex WHERE DIRECTORY = 'C:\Path' AND (CONTAINS ('"12-0430-1*"')) ORDER BY System.DateCreated DESC

So could somebody please link me a page with the current columns that can be searched over windows indexed files or say which column exists and would be working, I want to search through the indexed contents of the file.

Edit these are my settings with which I create the OleDBConnection:

OleDbConnection connection =  
                        new OleDbConnection("Provider=Search.CollatorDSO;Extended Properties='Application=Windows';");  
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,697 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,235 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,552 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Castorix31 81,636 Reputation points
    2022-06-17T12:22:51.727+00:00

    So could somebody please link me a page with the current columns that can be searched over windows indexed files

    In MSDN : Windows Properties

    I want to search through the indexed contents of the file.

    The content is System.Search.Contents,
    equivalent to "content:xxx" with Advanced Query Syntax (it is localized ("contenu" on my french OS if I test with Explorer or ISearchQueryHelper))

    0 comments No comments

  2. Tom Phillips 17,716 Reputation points
    2022-06-17T16:50:15.637+00:00

    I believe the correct field name is "System.FileName", not "System.FullText"

    SELECT TOP 2000 System.FileName FROM systemindex WHERE DIRECTORY = 'C:\Path...' AND System.FileName Like '%12-0430-1%' ORDER BY System.DateCreated DESC  
    
    0 comments No comments

  3. LiHong-MSFT 10,046 Reputation points
    2022-06-21T07:59:38.69+00:00

    Hi @Brian Michelson

    The error says because the column does not exist

    It seems you shouldn't use System.FullText Like .... Have you checked the solution answered by Tom and is there any update now?

    Best regards,
    LiHong

    0 comments No comments