Upload
gunnar-peipman
View
628
Download
0
Embed Size (px)
Citation preview
Azure Search Deep Dive
Gunnar PeipmanASP.NET/IIS MVP
http://gunnarpeipman.com
Two types of people1. Navigation people2. Search people
Q: What do navigation people with search? A: They type in their favorite link catalog URL, search for it and then start navigating again
Components of search systems• Crawler – in web systems finds resources to index• Indexer – adds found resources to search index• Analyzis – performs analyzis of on indexed content• Query – performs search and returns results
Search technologies this far• Desktop search – indexes desktop content (files, mailboxes, media)• Bing – web search• SharePoint search – search from enterprise data, web, and LOB
systems
Azure Search• Desktop search – doesn’t scale• Bing – oriented to web• SharePoint Search – extremely powerful but expensive • Azure Search – lightweight custom search offered as a service
Elastic in the cloud?• Built on top of Elastic Search• Still it is not cloud-hosted Elastic Search• Azure Search has its own JSON-based API-s
Tips’n’tricks• Search index must contain only two types of data:• Data to search• Data to display results
• Analyze what data is minimally needed for search• Often search index is flat presentation of some domain classes• If needed use more than one index• Don’t allow users to come out with requirement „search for
everything“ – visualize them what everything means
Creating search index• Join Microsoft Azure• Create free or paid Azure Search service• Use one of these to create search indices:• Use Azure Preview Portal• Use Azure Search library (full .NET only)• Use plain JSON requests (full .NET and CoreCLR)
• Configure indices
Managing index• Update index after insert, update and delete• Update index after related data is changed• Support indexing from data sources• Make it easy to refresh all items in index• Keep users away from Azure portal and JSON
I want indexing to be easy and automated process
Managing search indexSingle product scenario:1. Product changed2. Detect change type3. Update index
This flow can be implemented behind inser, update and delete operations.
Managing search indexMultiple product scenario:1. Query for products to index2. Save changes to index with up to 16K batches
Do this when:3. Product category name changes4. Products in category have some new attribute5. Products for query are changed
Managing search indexAll products scenario:1. Create query to retrieve all products 2. Use paging to keep load normal3. Send changes for page to index4. You may want to write console application or service for this
Do this when:5. You need to re-create search index 6. Big number of products have changed and there’s no query for detecting
changed products
Paging scenario• Support different search providers:• Azure Search• Search from SQL Server• SharePoint Search• Custom NoSQL database
• Search clients should know nothing about current search provider• We need one query and one
response class to keep clients away from details
Paging• Azure Search supports paging• PagedResult<T> - my construct for all pagings• Base class – carries data also to pagers in UI• Generic class – carries typed results to callers• Query class and PagedResult classes are the only data
transfer mechanism between layers
Scoring profiles• Scoring profiles help search to rank results• Scoring types:
• Weights – how importamt is match for fields• Freshness – how new or old item is• Magnitude – how high or low numeric value is• Distance – proximity and geographic location
• Function aggregation:• Sum• Average• Minimum• Maximum
• One scoring profile per search request!
I want to get acurate results when searching
products
Faceted navigation• Facets are those blocks on listings where
visitors can set additional filters• Example: price range, manufacturers, flight
companies etc
I want simple filters to narrow down search
results
Suggesters• Suggester is „lightweight search“• Used to look up results from search index• Works well for auto-complete search boxes
Sometimes I want suggestions when typing
phrase to search box
Tag boosting• Add groups of tags to products• Each group can boost up search results rank for
given products• Example: based on customer preferences
boost up the rank of specific brands
I always want to see my favorite products first in
listings
Indexers• Automated index updates• Build queries• Define data sources• Define indexers• If needed run on schedulers
Can I skip coding and import fresh data to index
from data source?