Query Catalog of Indexing Service (Question about Query Dialect) - Inetserver
This is a discussion on Query Catalog of Indexing Service (Question about Query Dialect) - Inetserver ; I'm indexing the contents of a folder with the Microsoft Indexing
Service which builds a catalog. For simplicification in that folder
are only *.txt-Files. With a simple ASP page I query the catalog,
means I can search for a specific ...
-
Query Catalog of Indexing Service (Question about Query Dialect)
I'm indexing the contents of a folder with the Microsoft Indexing
Service which builds a catalog. For simplicification in that folder
are only *.txt-Files. With a simple ASP page I query the catalog,
means I can search for a specific textfile in which the searched
string can be found.
In the line: "searchstring =" you just type the desired string you are
looking for and call the this asp-page, for example:
http://localhost/search.asp
The script will show you all documents (textfiles) that contain the
searchstring.
(Look at this working script first, below it my question will follow)
search.asp:
//-----------------------------------------------------------------------
<html>
<head>
<title>
Search Results
</title>
</head>
<body>
<%
' This section sets the various configuration variables
pagesize = 5000
maxrecords=5000
searchstring="Hotline"
catalogtosearch="TestCatalog"
searchrankorder="rank[d]"
origsearch=searchstring
%>
<%
'This section performs the query
dim q
dim util
set q=server.createobject("ixsso.query")
set util=server.createobject("ixsso.util")
q.query=searchstring
q.catalog=catalogtosearch
q.sortby=searchrankorder
q.columns="doctitle, filename, size, write, rank, directory, path"
q.maxrecords=maxrecords
%>
<%
'This section displays the results
set rs=q.createrecordset("nonsequential")
rs.pagesize=pagesize
response.write"<p>Your search for <b>" & origsearch & "</b> produced "
if rs.recordcount=0 then response.write "no results"
if rs.recordcount=1 then response.write "1 result: "
if rs.recordcount>1 then response.write(rs.recordcount) & " results: "
%>
<table border=1><tr><td><b>Title</b></td><td><b>Filename</b></
td><td><b>Date /
Time</b></td><td><b>Size</b></td><td><b>Relevance</b></
td><td><b>Directory</b></td></tr>
<%
do while not rs.EOF
response.write "<tr><td>" & rs("doctitle") & "</td><td>" & "<a href="
& "'" & rs("path") & "'" & ">" & rs("filename") & "</a>" &
"</td><td>" & rs("write") & "</td><td>" & rs("size") & "</td><td>" &
rs("rank") & "</td><td>" & rs("directory") & "</td></tr>"
rs.movenext
loop
response.write "</table>"
set rs=nothing
set q=nothing
set util=nothing
%>
</body>
</html>
//-----------------------------------------------------------------------
As you can see, I defined the searchstring simple like this:
searchstring="Hotline"
Means the script will find all textfiles that have somewhere "Hotline"
inside them (and this really works).
The Index Server now has it's own query language, for Index Server
3.x
by default the query dialect 2 is used. With that dialect it should be
possible
to query following examples:
$CONTENTS ppdev visual basic
-> Find all documents which contain at least one of the 3 words above
@CONTENTS ppdev visual basic
-> Find all document which contain the string "ppdev visual basic"
$CONTENTS ppdev AND visual AND basic
-> Find all documents which contain all 3 words above (no matter in
what order)
With that knowledge it should now be possible to search for textfiles
that contain for example "Microsoft" and "Hotline" in them, therefore
I
changed my searchstring to:
searchstring="$CONTENTS Microsoft AND Hotline"
If you execute the script, it will really find now all documents that
contain "Microsoft" and "Hotline" in them (everything ok so far...)
Now what I don't understand is, if you specify the searchstring like
this:
searchstring="$CONTENTS Microsof AND Hotline"
the Indexserver won't return any results anymore?
In the Index Query Language Wildcards should be supported,
but also if you query like:
searchstring="$CONTENTS Microsof* AND Hotline"
or
searchstring="$CONTENTS Microsof? AND Hotline"
the Indexserver still won't return any results...
Does anybody have an idea why this doesn't work?
If found an interesting which mention similar problems:
http://www.aimingtech.com/file_searching.htm
(Look at the section "Undocumented Surprises in Indexing Service")
There they write that you should add "& #size>0" to your query,
therefore I tryed it like this too:
searchstring="$CONTENTS Microsof* AND Hotline AND #size>0"
(Note that "AND" and "&" are the same...)
I also tryed like this:
searchstring="$CONTENTS Microsof* AND Hotline AND #size > 0"
and also like this:
searchstring="$CONTENTS Microsof* AND Hotline AND @size>0"
(I guess they wrote it wrong in that site with #size, it should be
@size normally..)
Still the IndexServer doesn't return any results, it only returns
results if I write
searchstring="$CONTENTS Microsoft AND Hotline AND @size > 0"
or simply
searchstring="$CONTENTS Microsoft AND Hotline"
I've found another interesting article that adresses the wildcard
topic:
http://support.microsoft.com/kb/320942/en-us
So what I tryed is that I adjusted my script above like this:
<%
'This section performs the query
dim q
set q=server.createobject("ixsso.query")
q.query=searchstring
q.dialect = 1
q.catalog=catalogtosearch
q.sortby=searchrankorder
q.columns="doctitle, filename, size, write, rank, directory, path"
q.maxrecords=maxrecords
%>
And the searchline I set again to:
searchstring="$CONTENTS Microsof* AND Hotline"
Still I don't get any results back
(even there is for SURE a textfile indexed that holds both of the
searched words...)
When you search on the Internet, you always find a lot of exmaples
with a simple searchstring like
searchstring="Hotline"
But I didn't find anything that explains me why I can't search for
searchstring="$CONTENTS Microsof AND Hotline"
or
searchstring="$CONTENTS Microsof* AND Hotline"
Anybody around with a hint for me?
-
Re: Query Catalog of Indexing Service (Question about Query Dialect)
@ Is contains, it supports wildcarding, $ is freetext, it stems all words in
the search phrase for plural, singular, and any verbal derivations (book,
booking, booked, etc).
Microsof AND Hotline will only return documents which contain Microsof AND
Hotline. I suspect this is why you aren't getting results.
--
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
<amarkov@gmx.net> wrote in message
news:1170768867.054803.288510@v45g2000cwv.googlegroups.com...
> I'm indexing the contents of a folder with the Microsoft Indexing
> Service which builds a catalog. For simplicification in that folder
> are only *.txt-Files. With a simple ASP page I query the catalog,
> means I can search for a specific textfile in which the searched
> string can be found.
> In the line: "searchstring =" you just type the desired string you are
> looking for and call the this asp-page, for example:
>
> http://localhost/search.asp
> The script will show you all documents (textfiles) that contain the
> searchstring.
>
> (Look at this working script first, below it my question will follow)
>
> search.asp:
> //-----------------------------------------------------------------------
> <html>
> <head>
> <title>
> Search Results
> </title>
> </head>
> <body>
>
> <%
> ' This section sets the various configuration variables
> pagesize = 5000
> maxrecords=5000
> searchstring="Hotline"
> catalogtosearch="TestCatalog"
> searchrankorder="rank[d]"
> origsearch=searchstring
> %>
>
> <%
> 'This section performs the query
>
> dim q
> dim util
> set q=server.createobject("ixsso.query")
> set util=server.createobject("ixsso.util")
> q.query=searchstring
> q.catalog=catalogtosearch
> q.sortby=searchrankorder
> q.columns="doctitle, filename, size, write, rank, directory, path"
> q.maxrecords=maxrecords
> %>
>
> <%
> 'This section displays the results
>
> set rs=q.createrecordset("nonsequential")
> rs.pagesize=pagesize
> response.write"<p>Your search for <b>" & origsearch & "</b> produced "
>
> if rs.recordcount=0 then response.write "no results"
> if rs.recordcount=1 then response.write "1 result: "
> if rs.recordcount>1 then response.write(rs.recordcount) & " results: "
>
> %>
>
> <table border=1><tr><td><b>Title</b></td><td><b>Filename</b></
> td><td><b>Date /
>
> Time</b></td><td><b>Size</b></td><td><b>Relevance</b></
> td><td><b>Directory</b></td></tr>
>
> <%
> do while not rs.EOF
>
> response.write "<tr><td>" & rs("doctitle") & "</td><td>" & "<a href="
> & "'" & rs("path") & "'" & ">" & rs("filename") & "</a>" &
>
> "</td><td>" & rs("write") & "</td><td>" & rs("size") & "</td><td>" &
> rs("rank") & "</td><td>" & rs("directory") & "</td></tr>"
>
>
> rs.movenext
> loop
>
> response.write "</table>"
> set rs=nothing
> set q=nothing
> set util=nothing
> %>
>
> </body>
> </html>
> //-----------------------------------------------------------------------
>
> As you can see, I defined the searchstring simple like this:
> searchstring="Hotline"
>
> Means the script will find all textfiles that have somewhere "Hotline"
> inside them (and this really works).
>
> The Index Server now has it's own query language, for Index Server
> 3.x
> by default the query dialect 2 is used. With that dialect it should be
> possible
> to query following examples:
>
> $CONTENTS ppdev visual basic
> -> Find all documents which contain at least one of the 3 words above
>
> @CONTENTS ppdev visual basic
> -> Find all document which contain the string "ppdev visual basic"
>
> $CONTENTS ppdev AND visual AND basic
> -> Find all documents which contain all 3 words above (no matter in
> what order)
>
> With that knowledge it should now be possible to search for textfiles
> that contain for example "Microsoft" and "Hotline" in them, therefore
> I
> changed my searchstring to:
> searchstring="$CONTENTS Microsoft AND Hotline"
>
> If you execute the script, it will really find now all documents that
> contain "Microsoft" and "Hotline" in them (everything ok so far...)
>
> Now what I don't understand is, if you specify the searchstring like
> this:
> searchstring="$CONTENTS Microsof AND Hotline"
> the Indexserver won't return any results anymore?
>
> In the Index Query Language Wildcards should be supported,
> but also if you query like:
> searchstring="$CONTENTS Microsof* AND Hotline"
> or
> searchstring="$CONTENTS Microsof? AND Hotline"
> the Indexserver still won't return any results...
>
> Does anybody have an idea why this doesn't work?
>
>
> If found an interesting which mention similar problems:
> http://www.aimingtech.com/file_searching.htm
> (Look at the section "Undocumented Surprises in Indexing Service")
> There they write that you should add "& #size>0" to your query,
> therefore I tryed it like this too:
> searchstring="$CONTENTS Microsof* AND Hotline AND #size>0"
> (Note that "AND" and "&" are the same...)
>
> I also tryed like this:
> searchstring="$CONTENTS Microsof* AND Hotline AND #size > 0"
>
> and also like this:
> searchstring="$CONTENTS Microsof* AND Hotline AND @size>0"
> (I guess they wrote it wrong in that site with #size, it should be
> @size normally..)
>
> Still the IndexServer doesn't return any results, it only returns
> results if I write
> searchstring="$CONTENTS Microsoft AND Hotline AND @size > 0"
> or simply
> searchstring="$CONTENTS Microsoft AND Hotline"
>
>
> I've found another interesting article that adresses the wildcard
> topic:
> http://support.microsoft.com/kb/320942/en-us
>
> So what I tryed is that I adjusted my script above like this:
> <%
> 'This section performs the query
>
> dim q
> set q=server.createobject("ixsso.query")
> q.query=searchstring
> q.dialect = 1
> q.catalog=catalogtosearch
> q.sortby=searchrankorder
> q.columns="doctitle, filename, size, write, rank, directory, path"
> q.maxrecords=maxrecords
> %>
>
> And the searchline I set again to:
> searchstring="$CONTENTS Microsof* AND Hotline"
>
> Still I don't get any results back
> (even there is for SURE a textfile indexed that holds both of the
> searched words...)
>
> When you search on the Internet, you always find a lot of exmaples
> with a simple searchstring like
> searchstring="Hotline"
> But I didn't find anything that explains me why I can't search for
> searchstring="$CONTENTS Microsof AND Hotline"
> or
> searchstring="$CONTENTS Microsof* AND Hotline"
>
> Anybody around with a hint for me?
>
-
Re: Query Catalog of Indexing Service (Question about Query Dialect)
> Microsof AND Hotline will only return documents which contain Microsof AND
> Hotline. I suspect this is why you aren't getting results.
Yes, but my question was:
Why "Microsof AND Hotline" doesn't return any results?
(Note that I left away the "T" from Microsoft...)
-
Re: Query Catalog of Indexing Service (Question about Query Dialect)
Note that I left the t off also. I am confused by your response.
--
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Alen Markov" <amarkov@gmx.net> wrote in message
news:f10e1$45cf109e$544a3272$28316@news.hispeed.ch...
>> Microsof AND Hotline will only return documents which contain Microsof
>> AND
>> Hotline. I suspect this is why you aren't getting results.
>
> Yes, but my question was:
>
> Why "Microsof AND Hotline" doesn't return any results?
> (Note that I left away the "T" from Microsoft...)
>
>
>
>
>
-
Re: Query Catalog of Indexing Service (Question about Query Dialect)
> Note that I left the t off also. I am confused by your response.
Ops - sorry for inconvenience, I really overlooked that you left away
the T too...
Well just a bit confused because the String "Microsof" is contained in
"Microsoft" and thought
that the Index Server should therefore be able to find it too... In
this case I will have
to tell the users that a search like "Microsof" is simply not possible
and that they must
use a Wildcard instead...
Thanks for your answer
Alen
Similar Threads
-
By Application Development in forum Inetserver
Replies: 2
Last Post: 11-08-2006, 06:21 AM
-
By Application Development in forum Inetserver
Replies: 1
Last Post: 01-22-2006, 07:45 AM
-
By Application Development in forum Inetserver
Replies: 1
Last Post: 12-01-2004, 02:02 PM
-
By Application Development in forum Inetserver
Replies: 4
Last Post: 01-20-2004, 06:21 PM
-
By Application Development in forum Inetserver
Replies: 0
Last Post: 01-15-2004, 09:48 PM