Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Indexing Service results Restriction 1

Status
Not open for further replies.

techskool

Technical User
Jun 20, 2002
151
GB
After much work trying to understand the microsoft knowledge base's ideas on how to set up Indexing Service for web pages, it finally works.

You know the Routine, you have an IDQ file and a HTX file to interogate the catalog.

Within the htx file i write out the matches, from the relevant indexed folders,... but, and heres the thing, there is an asp file within each folder i have indexed, which needs to be there, but i do not want to be returned in the results.

As HTX files use the Begin Detail / End Detail command, its not like your traditional for 1 to I loop which you can just prefix with <%'If Filename <> &quot;somefile.asp&quot; Then%>.

So my question is how do i make the service ignore the .asp file extension, or infact any file extension, or will indexing service always return all files within a foler.

Thanks in advance guys

Dave
 
&quot;You know the Routine, you have an IDQ file and a HTX &quot;

I can't remember why i skipped that approach. Here is (a part of) how i query the index:


cScope = &quot;/&quot; ' You can start the search on a lower level
cOrder = &quot;Rank&quot; ' Sort the results
strQuery = Request.form(&quot;Query&quot;) ' What to look for
strCatalog = &quot;mycatalog&quot; ' name of the catalog

' Build the SQL querystring:
strSearch = BuildQuery(cScope, strQuery)

' Open connection
set oConn = Server.CreateObject(&quot;ADODB.Connection&quot;)
oConn.ConnectionString = &quot;provider=msidxs; Data Source=&quot; &_
strCatalog
oConn.Open
Set oRS = Server.CreateObject(&quot;ADODB.RecordSet&quot;)
oRS.Open strSearch, oConn

' and then you have a recordset ready for display...





' In this function you build the SQL statement
Function BuildQuery(strScope, strQuery)
Dim strPropertyName
Dim SQL 'SQL string to search against
Dim strQText
Dim blnAddedQ
Dim intQPos
DIM QUOT
QUOT = chr(34)

SQL = &quot;SELECT DocTitle, Filename, Vpath, Size, Write, Characterization, Rank FROM &quot;
If strScope = &quot;&quot; Then
SQL = SQL & &quot;SCOPE() &quot;
Else
SQL = SQL & &quot;SCOPE('DEEP TRAVERSAL OF &quot; & QUOT &_
strScope & QUOT & &quot;')&quot;
End if
strQText = strQuery
If InStr(strQText, &quot; &quot;) > 0 Or InStr(strQText, &quot;'&quot;) > 0 Then
blnAddedQ = False
If Left(strQText, 1) <> QUOT Then
strQText = QUOT & strQText
blnAddedQ = True
End If
If Right(strQText, 1) <> QUOT Then
strQText = strQText & QUOT
blnAddedQ = True
End If
If blnAddedQ Then
intQPos = Instr(2, strQText, QUOT)
Do While intQPos > 0 And intQPos < Len(strQText)
strQText = Left(strQText, intQPos - 1) & &quot; &quot; & Mid(strQText, intQPos + 1)
intQPos = Instr(2, strQText, QUOT)
Loop
End If
End If
' AND HERE YOU DEFINE WHICH FILE EXTENTIONS MUST BE
' INCLUDED IN THE RESULT

SQL = SQL & &quot;WHERE CONTAINS ('&quot; & strQText & &quot;') > 0&quot;
SQL = SQL & &quot; AND (Filename LIKE '%.html'&quot;
'-- comment any of next lines to exclude certain files
SQL = SQL & &quot; OR Filename LIKE '%.pdf'&quot;
SQL = SQL & &quot; OR Filename LIKE '%.doc'&quot;
SQL = SQL & &quot; OR Filename LIKE '%.xls'&quot;
SQL = SQL & &quot; OR Filename LIKE '%.ppt'&quot;
SQl = SQL & &quot; OR Filename LIKE '%.txt'&quot;
SQL = SQL & &quot; OR Filename LIKE '%.htm')&quot;
SQL = SQL & &quot; ORDER BY &quot; & strOrder & &quot; DESC&quot;
BuildQuery = SQL
End Function



hth,
Foxbox
ttmug.gif
 
Thanks foxbox

Do you use this method because there isnt much control with the htx and idq file? Microsoft recommends you use them, ... but microsoft recommendes a lot of stuff!

I know i can to ignore a file in a standard vbscript statement, what i want to know if i can do it within the htx or idq file, ... are there any commands like CiFileIgnore (I wish) you get the picture.

Basically the standard asp check for file will not work because you cannot check on each iteration of a loop within a recordset whether the file matches or not, indexing service caches these results.

So you think i should abandon these files and just stick to scripts i know??

Thanks for all the help so far

Dave

 
My method is what happens in all my ASP programs: with a SQL statement i retrieve the records i want from a (MS SQL) database and then display the result. The performance is oke and no need to learn IDQ and HTX syntax.

Each time the user starts a search, a new SQL query is build, and in this query there is a selection of filetypes a want in the result (maybe one day i make that dynamic too). I don't see problems with the service caching results.



hth,
Foxbox
ttmug.gif
 
Thanks for all the help foxbox, i can see now i will have to do it this way,.... and after all that time getting my head around those custom microsoft files!!!!

Im trying your code, but its not working,... just a few questions.


1)
--------------------------
oConn.ConnectionString = &quot;provider=msidxs; Data Source=&quot; &_
strCatalog

if thats the ole provider for indexing service, then i specify the data source as the name of the (indexing)catalog on the server, but it doesnt see it,.. is there something else i need to set up?

2)
----------------------------
To what extent do i need to reference what i was using before in the idq file:

CiCatalog=indexing_service
CiColumns=filename,size,rank,characterization,vpath,DocTitle,write
CiRestriction=%Restriction%
CiMaxRecordsInResultSet=1000
CiMaxRecordsPerPage=10
CiScope=/
CiFlags=DEEP
CiTemplate=/internal_materials/materials.htx
CiSort=rank[d]
CiForceUseCi=false

etc... and in fact how do i refernce these properties of indexing service.

Ive started messing and know this will work better that the files i was using but i keep getting the good old

'Microsoft OLE DB Provider for Indexing Service error '80040e14'
' and am now working on this when ive got other projects to finish off!!!!! this always happens!



I also heard somewhere there are no tables or views in the
Indexing Service catalog so how do you query it??

Thanks matey

Dave
 
1) mmmm, it is the catalog name as you created it under Indexing Services in Computer Management.

2) I do not use IDQ/ HTX so i do not know what those variables do. The engine heart of the script is the SQL statement. I guess this:

CiColumns= => SELECT DocTitle, Filename, Vpath, Size, Write, Characterization, Rank
CiMaxRecordsInResultSet=1000 => SELECT TOP 1000
CiMaxRecordsPerPage=10 => You must handle that in the ASP
CiSort=rank[d] => ORDER BY rank

Use Google for more info &quot;ASP MSIDXS SAMPLE&quot;. Eg





hth,
Foxbox
ttmug.gif
 
Hi Foxbox.

Thanks again for the help.

For some reason i cant get those scripts to work. I managed to find an article on the microsoft knowledge base, and it seems to be working now.

What i meant was can you reference the exact same properties, which i found you could with :

Server.CreateObject(&quot;ixsso.Query&quot;)
Server.CreateObject(&quot;ixsso.util&quot;)

This lets you reference all the same variables, sorry if this is what you meant, and i didnt get it but thanks again friend.

Dave

:)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top