Win: ADO and Index Server through Python

Andrew J Clover esuzm at dcs.warwick.ac.uk
Fri Aug 6 19:27:15 CEST 1999


Hmm. I'm not convinced this is a Python problem, but there doesn't seem to
be an appropriate group for Index Server, unless I've missed something, and
people using VB in ASPs seem to be able to get this stuff to work, so...

I'm using some Python CGIs to access MS Index Server through ADO using SQL
queries. Python and Index Server *seem* to be talking to each other, but
Index Server never returns *any* results no matter what the query is. The
index-building process seems to work fine; MMC reports I've got 1Mb of
catalog information and 34 documents indexed.

A test script follows. Does anyone with experience of using Index Server from
Python have any idea why Index Server might always return "0 results"? Am I
missing the point and doing something stupid? (Wouldn't be the first time.)

Or does anyone have any recommendations of a good non-Win-specific search
engine I could tie in instead of this nasty MS stuff?

# testIndexServer.py

import win32com.client
com= win32com.client.Dispatch
con= win32com.client.constants

query= "\
SELECT Filename, Path, DocTitle \
FROM SCOPE() \
WHERE CONTAINS (Contents, 'law')>0"

# any other query can be used with similar results; even a query with no
# 'WHERE' clause returns zero results

connection= com('ADODB.Connection')
connection.Provider= 'MSIDXS'
connection.Open('GlobalSite')
result= com('ADODB.RecordSet')
result.MaxRecords= 200
result.Open(query, connection, con.adOpenStatic)

print str(result.RecordCount)+' results'
while not (result.EOF==-1):
  print result.Fields('Filename')
  result.MoveNext()

connection.Close()

# help me

-- 
This posting was brought to you by And Clover.
(Sorry.)




More information about the Python-list mailing list