Discussion:
Query Catalog of Indexing Service (Question about Query Dialect)
(too old to reply)
a***@gmx.net
2007-02-06 13:34:27 UTC
Permalink
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?
Hilary Cotter
2007-02-10 13:05:58 UTC
Permalink
@ 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
Post by a***@gmx.net
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
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)
//-----------------------------------------------------------------------
<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>
//-----------------------------------------------------------------------
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
$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
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
searchstring="$CONTENTS Microsof AND Hotline"
the Indexserver won't return any results anymore?
In the Index Query Language Wildcards should be supported,
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?
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,
searchstring="$CONTENTS Microsof* AND Hotline AND #size>0"
(Note that "AND" and "&" are the same...)
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
or simply
searchstring="$CONTENTS Microsoft AND Hotline"
I've found another interesting article that adresses the wildcard
http://support.microsoft.com/kb/320942/en-us
<%
'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
%>
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?
Alen Markov
2007-02-11 12:45:29 UTC
Permalink
Post by Hilary Cotter
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...)
Hilary Cotter
2007-02-13 01:18:11 UTC
Permalink
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
Post by Alen Markov
Post by Hilary Cotter
Microsof AND Hotline will only return documents which contain Microsof AND
Hotline. I suspect this is why you aren't getting results.
Why "Microsof AND Hotline" doesn't return any results?
(Note that I left away the "T" from Microsoft...)
a***@gmx.net
2007-02-13 07:36:07 UTC
Permalink
Post by Hilary Cotter
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

Loading...