Question

I'm using the Windows Indexing Service for the first time and I need to return the doctitle and filename from the query.

My query is;

select doctitle, filename, vpath, rank, characterization from scope() where FREETEXT(Contents, '" & searchText & "') order by rank desc

I setup a fairly basic catalogue just pointing to a folder. I'm using this code from a website, the files are on the local machine and authentication shouldn't be a problem.

My search returns results but nothing in the filename property. The doctitle is populated but nothing else.

Thanks, Mike

Was it helpful?

Solution 2

I found the answer in this article; http://support.microsoft.com/kb/954822

You cannot index Internet Information Services (IIS) Web sites in Windows Server 2008 because of the design changes that were made to IIS 7.0.

The successor or the Indexing Service is Windows Search. Windows Search Wiki

Looks like I'm going to have to change the site to use Windows Search.

OTHER TIPS

I know it's been a few months since this has been answered, but I'm currently using WIS on Windows Server 2008 R2 using C# and came across this on a search. Sometimes I can't take no for an answer, so I had scoured the internet and came up with this solution.

I'm sure you can convert the code as necessary, but...

You'll have to install the Windows Server 2003 File Services Indexing Service from the Server Manager's Roles.

For the catalog properties, I disabled the Inheritable Settings and set the WWW Server appropriately. I also generated 250 character abstracts to be stored in the Characterization column.

When I set up my catalog, I included/excluded certain folders of my web site's directory (include the site root) and when I queried it, I used the below SQL statement:

EDIT: Note the use of FREETEXT(Filename, '\""+q+"\"')) to query the name of the file

String fileTypes = "\".aspx\" OR \".doc*\" OR \".xls*\" OR \".ppt*\" OR \".txt\" OR \".pdf\" OR \".rtf\"";
String q = query.Text.Replace("'", "''");   

sSqlString = "SELECT Filename, DocTitle, Size, VPath, Path, Rank, Write, Contents, Characterization ";
sSqlString += "FROM SCOPE() ";
sSqlString += "WHERE (CONTAINS(Contents, '\""+q+"\"') ";
sSqlString += "OR FREETEXT(Filename, '\""+q+"\"')) ";
sSqlString += "AND CONTAINS(Filename, '"+fileTypes+"') ";
sSqlString += "ORDER BY rank DESC, write DESC";

I create my connection using the using statement:

using(OleDbConnection conn = new OleDbConnection("Provider=MSIDXS.1;Data Source='"+catalog+"'"))
{
    //your connection and data collection code here
}

One of the issues that I have run into is with certain filetypes. If the document creator didn't include a document title in their MS Office product, you won't get the DocTitle. If the pdf doesn't have any recognizable text in it and the document properties are not filled out, the docTitle and Content will be empty. The way I look at it, is if the business doesn't make their files 508 compliant, they won't show up in the results properly.

Here's a quick snippet of the ListView template that I am using.

<ItemTemplate>
    <h3><a href="<%# vFilePath(Eval("Path")) %>"><%# Eval("DocTitle").ToString().Trim() == "" ? Eval("Filename").ToString().Split('.')[0] : ProperCase(Eval("DocTitle").ToString()) %></a></h3>
    <p><span style="color:#0083be;">
        <%# Request.ServerVariables["HTTP_HOST"].Length+vFilePath(Eval("Path")).Length > 100 ? (Request.ServerVariables["HTTP_HOST"]+vFilePath(Eval("Path"))).Substring(0,100)+"..." : Request.ServerVariables["HTTP_HOST"]+vFilePath(Eval("Path")) %></span><br />
        <span style="color:#4d4e53"><%# String.Format("{0:MMMM dd, yyyy}",Eval("Write")) %> - </span>
        <%# Eval("Characterization").ToString().Trim() == "" ? "..." : Eval("Characterization").ToString().Length == 250 ? 
        Eval("Characterization").ToString().Substring(0,250)+"..." : Eval("Characterization")%>
    </p>                
</ItemTemplate>

Since the docTitle in my case is used for the results header, I figured that if it's empty, I can take that empty string and replace it with the filename, minus the extention.

When making the query, make sure that you also properly use your meta tags using the keywords and description. This and the static content on the .aspx pages does get read by WIS. You'll note my use of Characterization to retrieve the contents.

This link provides instructions on setting up the W2k8 WIS along with vb.net code.

This link is a good source for the multitude of properties that can be queried and/or displayed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top