Windows Index Services and freetext searches don't work in Windows 2008 R2 or Windows 7 but works in 2003.
I created a catalog in windows index services called Catalog. In 2003 x86, I can use either of the two vbscripts to connect to the catalog and do free text searches to return results. The process doesn't return any results if I run it from
Windows 2008 R2 or Windows 7 x64 even under an administrative command prompt or with UAC disabled. Any suggestions to get this part of the index service working would be greatly appreciated.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' query.vbs to query windows index services
'
' Using MSIDXS
Set objConnection = CreateObject("ADODB.Connection")
objConnection.ConnectionString = "provider=msidxs;"
objConnection.Properties("Data Source") = "Catalog"
objConnection.Open
strText = "Text to search"
Set objCommand = CreateObject("ADODB.Command")
strQuery = "Select Path from Scope() Where " _
& "Freetext('%" & strText & "%')"
Set objRecordSet = objConnection.Execute(strQuery)
Do While Not objRecordSet.EOF
wscript.echo objRecordSet("Path")
objRecordSet.MoveNext
Loop
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' query.vbs to query windows index services
' Using IXSSO
Set objQuery = CreateObject("ixsso.Query")
strText = "Text to search"
Strquery = "{freetext}" & strText & "{/freetext}"
' Set it's properties
With objQuery
.Catalog = "Catalog" ' Catalog to query
.Query = strQuery ' Query text
.MaxRecords = 100 ' Max # of records to return
' What to sort records by. I'm sorting by rank [d]
' which is [d]escending by how pertinent Index Server
' thinks the result is. This way the most applicable
' result should be first.
.SortBy = "rank [d]"
' Which columns to return. Column names must
' be the same as the catalog's properties. Some
' of them are: contents, filename, size, path,
' vpath, hitcount, rank, create, write, DocTitle
' DocSubject, DocAuthor, DocKeywords...
.Columns = "filename, path, vpath, size, write, " _
& "characterization, DocTitle, DocAuthor, " _
& "DocKeywords, rank, hitcount"
End With
' Get a recordset of our results back from Index Server
Set rstResults = objQuery.CreateRecordset("nonsequential")
' Get rid of our Query object
Set objQuery = Nothing
' Check for no records
If rstResults.EOF Then
wscript.echo "Sorry. No results found."
wscript.quit
Else
varRecordCount = rstResults.RecordCount
' Loop through results
Do While Not rstResults.EOF
wscript.echo rstResults.Fields("Path")
' Move to next result
rstResults.MoveNext
Loop
End If
June 7th, 2011 10:17pm
The old XP/2003 index service is not installed by default in Windows Server 2008 R2 or Windows 7 but can be added by going to "Turn Windows features on or off" and choosing to install "Indexing service". Probably this is the reasonw why it does not work.Blogging about Windows for IT pros at
www.theexperienceblog.com
Free Windows Admin Tool Kit Click here and download it now
August 2nd, 2011 4:58am