Writing Code To Interact With Enterprise Search
Upcoming SlideShare
Loading in...5

Like this? Share it with your network


Writing Code To Interact With Enterprise Search



Slides from my talk at SharePoint Saturday Ozarks 2009 about writing code to interact with MOSS Enterprise Search.

Slides from my talk at SharePoint Saturday Ozarks 2009 about writing code to interact with MOSS Enterprise Search.



Total Views
Views on SlideShare
Embed Views



1 Embed 13

http://www.slideshare.net 13



Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment
  • Demo Keyword Query Syntax in Search Center
  • Demo query string syntax and RSS
  • Demo KeywordQuery class along with how to specify managed properties.
  • Demonstrate FullTextSqlQuery class.

Writing Code To Interact With Enterprise Search Presentation Transcript

  • 1. Writing Code to interact with Enterprise Search
    Corey Roth
    Blog: www.dotnetmafia.com
    Twitter: twitter.com/coreyroth
  • 2. Corey Roth
    Consultant for Stonebridge
    Worked in Consumer Electronics, Travel, Advertising, and Energy industries
    Currently doing MOSS development specializing in Enterprise Search
    Microsoft Award for Customer Excellence (ACE) Winner
    MCTS: MOSS 2007 Configuring
    E-mail: corey.roth@gmail.com
    Twitter: twitter.com/coreyroth
    Blog: www.dotnetmafia.com (mirrored on sharepointblogs.com)
  • 3. What is Enterprise Search?
    Enterprise Search is one of Microsoft’s current offerings to do search in the Enterprise
    Included in MOSS 2007
    Also available as a stand alone product (Search Server 2008 / Search Server Express)
    Allows for indexing and querying of documents from multiple sources (i.e.: documents, web sites, file shares, Active Directory (people), databases, web services, etc.)
  • 4. Interacting with Search
    Search Center
    Query String
    KeywordQuery Class
    FullTextSqlQuery Class
    Web Service
  • 5. Keyword Query Syntax
    Used to search by Managed Properties
    Can specify Scopes (Scope:”MyScope”)
    Does not support wildcard search
    AND implied between each keyword (i.e.: Color:”Red” Size:”M” is the same Color=“Red” AND Size=“M”)
    OR implied when multiple keywords of the same managed property used (i.e.: Color:”Red” Color:”Blue” translates to Color=“Red” OR Color=“Blue”)
    Can Specify Content Sources (ContentSource:”My Source”
    IsDocument:”1” – Query Documents Only
  • 6. URL Syntax
    Search Center and RSS pages accept queries via the query string
    Uses the keyword syntax specified on the K parameter (i.e.: results.aspx?k=Accounting)
    Can specify scope using the S parameter (i.e.: results.aspx?k=Account&s=Corporate Documents)
    Results can be paged with the start parameter
  • 7. KeywordQuery Class
    SharePoint API class to execute a query using Keyword Syntax
    Returns a ResultsTableCollection object which can be converted to a DataTable
    Can only be used on the SharePoint server
    Uses the credentials of the application executing the code (i.e.: the user who ran a console application, or the application pool account)
    SelectProperties can be used to add custom managed properties. You must add all default properties as well as your own custom properties if this is used.
  • 8. Full Text SQL Syntax
    T-SQL style method of querying Enterprise Search
    Can be used to do a wildcard search
    Specify columns in SELECT statement
    SELECT Title, Path, Write, Rank,…
    Always FROM Scope()
    Note syntax when using WHERE with a Scope
    WHERE “Scope” = ‘File Share’
    CONTAINS predicate supports wildcard search, FREETEXT does not
    ORDER BY clause can be used for ordering
    See Office Server SDK for more information
  • 9. Web Services
    Located on your SharePoint server in the _vti_bin virtual folder
    /_vti_bin/search.asmx – Enterprise Search web service
    /vti_bin/spsearch.asmx – WSS3 Search web service
    Both use the same syntax
    Web Service requires authentication
    Specify using .Credentials property
    Requires an input XML string
    Query method returns an XML string
    QueryEx method returns a DataSet
  • 10. Query Request Schema
    Can use Keyword Query syntax or Full Text SQL Query syntax
    QueryText element contains the query
    type=“STRING” – Keyword Query
    type=“MSSQLFT” – Full Text SQL Query
    Range / StartAt/ Count elements can be used for paging
    Properties element can be used to specify custom managed properties when using Keyword Query syntax
    SortByProperties element sorts keyword queries
    Note the casing of everything
  • 11. RSS
    Can use the URL syntax with the RSS page at http://<moss-server>/<SearchCenterUrl>/_layouts/srchrss.aspx
    Returns an XML document in RSS format containing search results
    Will not return custom managed properties
  • 12. Questions?
    Corey Roth
    Blog: www.dotnetmafia.com
    Twitter: twitter.com/coreyroth