|
Search Tips
At its simplest, a query can be just a word or a
phrase. But with the tips on this page, you can expand the focus of your
query to give you more complete results. These tips will get you started
with basic query language and acquaint you with the full power of Microsoft
Index Server.
-
Look for words with the same prefix. For
example, in your query form type key* to find key,
keying, keyhole, keyboard, and so on.
-
Search for all forms of a word. For example, in
the form type sink** to find sink,
sinking, sank, and sunk.
-
Search with the keyword NEAR,
rather than AND, for words close to each other.
For example, both of these queries, system and manager
and system near manager, look for the words system
and manager on the same page. But with NEAR, the
returned pages are ranked in order of proximity: The closer together the
words are, the higher the rank of that page.
-
Refine your queries with the AND NOT
keywords to exclude certain text from your search. For example, if you
want to find all instances of surfing but not
the Net, write the following query:
surfing AND NOT the Net
-
Add the OR keyword to find all instances of
either one word or another, for example:
Abbott OR Costello
This query finds all pages that mention Abbott or Costello
or both.
-
Put quotation marks around keywords if you want
Index Server to take them literally. For instance, if you type the
following query:
"system near manager"
Index Server will literally look for the complete phrase system near
manager. But if you type the same query without the quotation
marks:
system near manager
Index Server searches all documents for the words system and
manager.
Tips for Searching using SQL
The SELECT Statement
Use the SELECT statement to retrieve rows. The SELECT
statement consists of:
-
the SELECT-list which identifies the columns
(properties) of interest,
-
the FROM clause which specifies the scope (the set of
files) for the search, and
-
the WHERE clause which is the search criteria.
If the results must be ordered, you can add an additional
ORDER BY clause to return the rows in ascending or descending order.
Example
SELECT DocAuthor, size, DocTitle
FROM SCOPE(' "/IISSamples/ISSamples" ') WHERE CONTAINS(' "index server" ') >
0 ORDER BY size
The FROM Clause
The FROM clause of the SELECT statement is used to specify the
files on which to perform the search; that is, use the FROM clause to define
the query scope. You can use the SCOPE() function, which is the main
component of the FROM clause. The SCOPE function can take zero or more
comma-separated Scope_Arguments (that is, Traversal_Type and
Path combinations). You can specify SCOPE with an empty argument list,
or (). This is the default scope that uses the virtual root ( / ) as its
path. Each Scope_Argument must be surrounded by single quotes (see Examples
below).
In addition to using Scope(), you can also refer to any one of
a set of predefined views of Index Server properties that are often queried
against. You can reference one of these pre-defined views in the FROM clause
by specifying the pre-defined View_Name.
Examples
SELECT DocAuthor, size FROM SCOPE() WHERE size > 500000
SELECT DocAuthor, size
FROM SCOPE(' SHALLOW TRAVERSAL OF "D:\Contracts\open" ',' DEEP TRAVERSAL OF
"/Reports/Year 97" ')
WHERE CONTAINS(DocAuthor, ' "John" ') > 0
SELECT * FROM EXTENDED_WEBINFO
WHERE CONTAINS(DocSubject, ' "index server" NEAR() "internet information
server" ') > 0
The WHERE Clause
The WHERE clause of the SELECT statement specifies which rows
in the virtual table defined by the FROM clause make up the resulting rowset.
The WHERE clause consists of one or more search conditions (that is, one or
more predicates combined with AND, OR and NOT) that filter out rows for
which the search condition is false.
Examples
SELECT FileName, size FROM SCOPE() WHERE DocTitle =
'Financial Data' OR DocAuthor = 'John Smith'
SELECT FileName, DocAuthor FROM FILEINFO WHERE size < 10000 OR
DocWordCount <= 800
SELECT DocTitle, FileName, write FROM SCOPE()
WHERE CONTAINS (' "Index" NEAR() "Server" NEAR() "Microsoft"') > 0 AND size
< 5000
The ORDER BY Clause
The optional ORDER BY clause can be appended to the SELECT
statement to sort the rows returned in the rowset according to a specified
set of criteria. Results are sorted by default in ascending order. To sort
in descending order, specify DESC after the column name.
Example
SELECT FileName, DocTitle, size, rank FROM SCOPE(' "/MyDocs/Specs97",
"/YourDocs/Specs97" ')
WHERE FREETEXT (' "How do I index my HTML pages" ') > 0 ORDER BY rank, size
DESC
|