Your SlideShare is downloading. ×
Writing Code To Interact With Enterprise Search
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.

Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Writing Code To Interact With Enterprise Search


Published on

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.

Published in: Technology, Design

  • Be the first to comment

  • Be the first to like this

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide
  • 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.
  • Transcript

    • 1. Writing Code to interact with Enterprise Search
      Corey Roth
    • 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
      Blog: (mirrored on
    • 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