SlideShare a Scribd company logo
The Well-Tempered Search
Application
Variations on a Theme:
Why does my search app suck, and
what can I do about it?
Ted Sullivan – (old Phuddy Duddy)
Senior (very much so I’m afraid) Solutions (I hope) Architect (and sometime plumber)
Lucidworks Technical Services
Our Basic Premises (Premisi?)
• Lemma 1: Search Applications use algorithms that make
finding chunks of text within large datasets possible in
HTT (human-tolerable time).
• Lemma 2: These algorithms work by breaking text into
primitive components and building up a search
“experience” from that.
• Lemma 3: Lemma 2 is not sufficient to achieve Lemma 1.
The Basic Disconnect
• Text can be analyzed at the level of tokens
(syntax) and at the level of meaning
(semantics).
• We think one way (semantics), search engines
think another (syntax – i.e. token order).
• How do we bridge the gap? … More clever
algorithms!
Art and Science
• We need to be intelligent curators of these
algorithms. Craftsmen (craftswomen?) that
think of these as tools with a specific purpose.
• Like any good craftsperson – we need a wide
array of tools to get the job done (well
almost).
When is my search app done?
• Quick answer: NEVER (ain’t consultin’ great?)
• Long answer – As long as it is continues to
improve, like fine wine or bourbon, you are on
the path to enlightenment.
• How do you get there grasshopper? Add
semantic intelligence to the engine!
Search cannot be shrink-wrapped!!
What have we got for Donny behind Curtain #1 Jay?
Well Monty - Heeeeeeeeeeeerrrrrrrreeeeesssss the
Google … SEARCH Appliance!!!!
Search cannot be shrink-wrapped!!
What have we got for Donny behind Curtain #1 Jay?
Well Monty - Heeeeeeeeeeeerrrrrrrreeeeesssss the
Google … SEARCH Appliance!!!!*
Sorry Donny – It’s a ZONK!
* but Google Web Search has some Serious Mojo!
Prelude part 1– The basic problem
The inverted index and “bag-of-words” search:
The red fox jumped over the fence.
Time flies like an arrow. Fruit flies like a banana.
the 1,6
red 2
fox 3
jumped 4
over 5
fence 7
flies 2,7
like 3,8
Prelude part B – The Tried and True
• Phrase and Proximity boosting and “Slop”
• Synonyms and stop words
• Stemming or Lemmatization
• Autocomplete
• Best Bets / Landing Pages – the
sledgehammer
• Spell check – spell suggest – aka the warm
fuzzies.
Fugue - Subject or Exposition
Search engines need more ‘semantic
awareness’ or at least the illusion of this.
There is a heavy duty solution called Artificial
Intelligence – which except in the fertile
imagination of Hollywood screenwriters, is not
there yet. So we need to fake it just a bit.
Theme and Variations I
autophrasing and the red sofa
Theme: When multiple words mean just one thing.
Fuzzy way: Boosting phrases (proximity and phrase slop)
- pushes false positives down – i.e. out of the limelight
- i.e. - shoves ‘em under the rug
This encounters a problem with faceted search
Like the eye of Sauron in LOTR or Santa Claus, the faceting engine SEES
ALL (sins)!
Brake Pads example: hit on things that have ‘brake’ (like children’s stroller
brakes) and ‘pads’ – like mattress pads.
Variation I: Autophrasing
AutophrasingTokenFilter tells Lucene not to
tokenize when a noun phrase represents a single
thing - by providing a flat list of phrases.
Creates one-to-one token mapping that Lucene
prefers because it avoids the “sausagization”
problem.
https://github.com/LucidWorks/auto-phrase-tokenfilter
income tax refund
income tax
tax refund
“income tax” is not income.
A “tax refund” is not a tax.
Solution: Autophrasing + synonym mapping
income tax => tax
tax refund => refund
Autophrasing Example
Autophrasing Setup
autophrases.txt:
income tax
tax refund
tax rebate
sales tax
property tax
synonyms.txt
income_tax,property_tax,sales_tax,tax
tax_refund,refund,rebate,tax_rebate
<fieldType name="text_autophrase" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="com.lucidworks.analysis.AutoPhrasingTokenFilterFactory"
phrases="autophrases.txt"
includeTokens="true” replaceWhitespaceWith="_" />
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"
enablePositionIncrements="true" />
<filter class="solr.PorterStemFilterFactory"/>
</analyzer>
</fieldType>
Multi-term synonym problem
• New York, New York – it’s a HELLOVA town!
Subject was inspired by an old JIRA ticket: Lucene-1622
“if multi-word synonyms are indexed together with the
original token stream (at overlapping positions), then a query
for a partial synonym sequence (e.g., “big” in the synonym
“big apple” for “new york city”) causes the document to
match”
(or “apple” which will hit on my blog post if you crawl
lucidworks.com !)
This means certain phrase queries should match but don't (e.g.: "hotspot
is down"), and other phrase queries shouldn't match but do (e.g.: "fast
hotspot fi").
Other cases do work correctly (e.g.: "fast hotspot"). We refer to this
"lossy serialization" as sausagization, because the incoming graph is
unexpectedly turned from a correct word lattice into an incorrect
sausage.
This limitation is challenging to fix: it requires changing the index format
(and Codec APIs) to store an additional int position length per position,
and then fixing positional queries to respect this value.
Sausagization: from Mike McCandless blog Changing Bits:
Lucene's TokenStreams are actually graphs!
http://blog.mikemccandless.com/2012/04/lucenes-tokenstreams-are-actually.html
Multi-term synonym demo
new york
new york state
empire state
new york city
new york new york
big apple
ny ny
city of new york
state of new york
ny state
autophrases.txt
new_york => new_york_state,new_york_city,big_apple,
new_york_new_york,ny_ny,nyc,empire_state,ny_state,
state_of_new_york
new_york_state,empire_state,ny_state,
state_of_new_york
new_york_city,big_apple,new_york_new_york,ny_ny,nyc,
city_of_new_york
synonyms.txt
This document is about new york state.
This document is about new york city.
There is a lot going on in NYC.
I heart the big apple.
The empire state is a great state.
New York, New York is a hellova town.
I am a native of the great state of New York.
new york new york city new york state
Multi-term synonym demo
/select /autophrase
This document is about new york state.
This document is about new york city.
There is a lot going on in NYC.
I heart the big apple.
The empire state is a great state.
New York, New York is a hellova town.
I am a native of the great state of New York.
empire state
Multi-term synonym demo
/select /autophrase
(Even a blind squirrel finds a nut once in a while)
Variation II: The Red Sofa Problem
{
"response":{"numFound":3,"start":0,"docs":[
{
"color":"red",
”text":"This is the red sofa example. Please find with 'red sofa' query.",
{
"color":"red",
”text":"This is a red beach ball. It is red in color but is not something that you
should not sit on because you would tend to roll off.",
{
"color":"blue",
”text":"This is a blue sofa, it should only hit on sofas that are blue in color."]
}}
OOTB – q=red sofa is interpreted as text:red text:sofa (default OR)
http://localhost:8983/solr/collection1/select?q=red+sofa&wt=json
Closing the Loop:
Content Tagging and Intelligent Query Filtering
Using the search index itself as the knowledge source:
Solution for the Red Sofa problem
Query Autofiltering: Search Index driven query introspection /
query rewriting:
Lucene FieldCache Magic
Lucene FieldCache (to be renamed UninvertedIndex in Lucene 5.0)
Inverted Index:
Show all documents that have this term value in this field.
Uninverted or Forward Index:
Show all term values that have been indexed in this field.
SolrIndexSearcher searcher = rb.req.getSearcher();
SortedDocValues fieldValues = FieldCache.DEFAULT.getTermsIndex(
searcher.getAtomicReader( ), categoryField );
…
StringTokenizer strtok = new StringTokenizer ( query, " .,:;"'" );
while (strtok.hasMoreTokens( ) ) {
String tok = strtok.nextToken( ).toLowerCase( );
BytesRef key = new BytesRef( tok.getBytes() );
if (fieldValues.lookupTerm( key ) >= 0) {
Query Autofiltering
{
"response":{"numFound":1,"start":0,"docs":[
{
"id":"1",
"color":"red",
"description":"This is the red sofa example. Please find with 'red sofa' query."]
}
http://localhost:8983/solr/collection1/infer?q=red+sofa&wt=json
Now search for “red sofa” only returns ….. red sofas!
But – is this too “brute force”? The takeaway is that using
the search index AS a knowledge store can be very powerful!
Architecture: its all about Plumbing
• Pipelines for every occasion.
Indexing Pipelines – good ‘ole ETL
- Content enrichment, tagging
- Metadata cleanup
Query Pipelines
– identification, query preprocessing
- introspection
One is the “hand” the other, the “glove”
Index Pipelines
Lots of choices here:
• Internal to Solr – DIH, UpdateRequestProcessor
Pros and cons
• External – Morphlines, Open Pipeline, Flume,
Spark, Hadoop, Custom SolrJ
• Lucidworks Fusion
Entity and Fact Extraction
Entities:
Things, Locations, Dates, People, Organizations, Concepts
Entity Relationships
Company was acquired by Company
Drug cures Disease
Person likes Pizza
Annotation Pipelines (UIMA, Lucidworks Fusion):
Entity Extraction followed by Fact Extraction
Pattern method:
$Drug is used to treat $Condition
Parts of Speech (POS) analysis
Subject Predicate Object
Theme and Variations II
The Classification Wars
• Machine Learning or Taxonomy – is it a Floor
Wax or a Dessert Topping?
Answer: It’s a floor wax AND a dessert topping! Its delicious and just look at that shine!
Machine Learning
Use mathematical vector-crunching algorithms like Latent
Dirichlet Allocation (LDA), Bayesian Inference, Maximum
Entropy, log likelihood, Support Vector Machines (SVM) etc., to
find patterns and to associate those patterns with concepts.
Can be supervised (i.e. given a training set) or unsupervised (the
algorithm just finds clusters). Supervised learning are called
semi-automatic classifiers.
Check out Taming Text by Ingersoll, Morton and
Farris (Manning)
Machine Learning In
LucidworksFusion
Training Data
NLP Trainer
Stage
NLP Model
Test Data
NLP Classifier
Stage
Classified
Documents
Taxonomy or Ontology
“Knowledge graphs” that relate things and concepts to each other
either hierarchically or associatively.
Pros:
Works without large amounts of content to analyze
Encapsulates the knowledge of human subject matter experts
Cons:
Often not well designed for search (mixes semantic relationship
types / organizational logic)
Requires curation by subject matter experts whose time is costly
Taxonomies Designed for Search
Category nodes and Evidence nodes
Category Node:
A ‘parent’ node
Can have child nodes that are:
Sub Categories
Evidence Nodes
Evidence Node:
Tends to be a leaf node (no children)
Contains keyterms (synonyms)
May contain “rules” e.g. (if contains term a and term b but not term c)
Evidence Nodes can have more than one category node parent
Hits on Evidence Nodes add to the cumulative score of a Category Node.
Scores can be diluted as the accumulate up the hierarchy – so that the
nearest category gets the strongest ‘vote’.
US Corporations
Foreign Corporations
British
Chinese
French
German
Japanese
Russian
etc.
Fortune 100 Companies
Energy
Financial Services
Investment Banks
Commercial Banks
Health Care
Health Insurance
HMO
Medical Devices
Pharmaceuticals
Hospitality
Manufacturing
Aircraft
Automobiles
Electrical Equipment
Ford, GM, Chrysler
Fortune 100 Companies
Energy
Financial Services
Investment Banks
Commercial Banks
Health Care
Health Insurance
HMO
Medical Devices
Pharmaceuticals
Hospitality
Manufacturing
Aircraft
Automobiles
Electrical Equipment
US Corporations
Foreign Corporations
British
Chinese
French
German
Japanese
Russian
etc.
Ford, GM, Chrysler,Toyota,BMW
Fortune 100 Companies
Energy
Financial Services
Investment Banks
Commercial Banks
Health Care
Health Insurance
HMO
Medical Devices
Pharmaceuticals
Hospitality
Manufacturing
Aircraft
Automobiles
Electrical Equipment
US Corporations
Foreign Corporations
British
Chinese
French
German
Japanese
Russian
etc.
Fortune 100 Companies
Energy
Financial Services
Investment Banks
Commercial Banks
Health Care
Health Insurance
HMO
Medical Devices
Pharmaceuticals
Hospitality
Manufacturing
Aircraft
Automobiles
Electrical Equipment
Ford, GM, Chrysler,Toyota,BMW
GE, Boeing
US Corporations
Foreign Corporations
British
Chinese
French
German
Japanese
Russian
etc.
Fortune 100 Companies
Energy
Financial Services
Investment Banks
Commercial Banks
Health Care
Health Insurance
HMO
Medical Devices
Pharmaceuticals
Hospitality
Manufacturing
Aircraft
Automobiles
Electrical Equipment
Ford, GM, Chrysler,Toyota,BMW
GE, Boeing
Bank of America, Hyatt
US Corporations
Foreign Corporations
British
Chinese
French
German
Japanese
Russian
etc.
Query Pipelines
The ‘Wh’ Words: Who, What, When, Where
Who are they (authentication)?
What can they see (security - authorization)?
When can they see it (entitlement)?
What are they interested in (personalization / recommendation)?
Where are they now (location)?
Query Pipelines
Inferential Search
Query introspection -> Query modification.
Query Autofiltering
Are you feeling lucky today?
Topic boosting / spotlighting
Use ML to detect the topic, then boost and/or spotlight
results tagged this way.
Use a specialized collection to store ‘facet knowledge’
The Art of the Fugue:
Inferential Search
• Infer what the user is looking for and give them
that
• Clever software infers meaning aka query
“intent”
• When we do this right, it appears to be magic!
Machine Learning Drives
Query Introspection
Training Data
NLP Trainer
Stage
NLP Model
Test Data
NLP Classifier
Stage
Classified
Documents
Machine Learning models can drive
Query Introspection
NL Query
NLP Query
Stage
NLP Model
Tagged
Query
Landing
Page
Boost
Documents
Da Capo al Coda
• Killer search apps are crafted from fine
ingredients and like fine whiskey will get
better with age - if you are paying attention to
‘what’ your users are looking for.
• Putting the pieces together requires an
understanding of ‘what’ things, independent
of what words they use to describe it.
Thanks for your attention!
Ted Sullivan
Lucidworks, Technical Services
ted.sullivan@lucidworks.com
Skype: ted.sullivan5
LinkedIn
Metuchen, New Jersey
(You gotta problem with that?)

More Related Content

Similar to The well tempered search application

Webinar: Simpler Semantic Search with Solr
Webinar: Simpler Semantic Search with SolrWebinar: Simpler Semantic Search with Solr
Webinar: Simpler Semantic Search with Solr
Lucidworks
 
Data Day Seattle, From NLP to AI
Data Day Seattle, From NLP to AIData Day Seattle, From NLP to AI
Data Day Seattle, From NLP to AI
Jonathan Mugan
 
From Natural Language Processing to Artificial Intelligence
From Natural Language Processing to Artificial IntelligenceFrom Natural Language Processing to Artificial Intelligence
From Natural Language Processing to Artificial Intelligence
Jonathan Mugan
 
Conf orm - explain
Conf orm - explainConf orm - explain
Conf orm - explain
Louise Grandjonc
 
Fluid, Fluent APIs
Fluid, Fluent APIsFluid, Fluent APIs
Fluid, Fluent APIs
Erik Rose
 
Write better python code with these 10 tricks | by yong cui, ph.d. | aug, 202...
Write better python code with these 10 tricks | by yong cui, ph.d. | aug, 202...Write better python code with these 10 tricks | by yong cui, ph.d. | aug, 202...
Write better python code with these 10 tricks | by yong cui, ph.d. | aug, 202...
amit kuraria
 
Ruby meetup evolution of bof search
Ruby meetup   evolution of bof search Ruby meetup   evolution of bof search
Ruby meetup evolution of bof search
Miha Mencin
 
Rocky Nevin's presentation at eComm 2008
Rocky Nevin's presentation at eComm 2008Rocky Nevin's presentation at eComm 2008
Rocky Nevin's presentation at eComm 2008eComm2008
 
Introduction to Algorithms
Introduction to AlgorithmsIntroduction to Algorithms
Introduction to Algorithms
Mohamed Essam
 
Extreme Swift
Extreme SwiftExtreme Swift
Extreme Swift
Movel
 
Drupal 8: A story of growing up and getting off the island
Drupal 8: A story of growing up and getting off the islandDrupal 8: A story of growing up and getting off the island
Drupal 8: A story of growing up and getting off the island
Angela Byron
 
Algorithms
Algorithms Algorithms
Algorithms
Mohamed Essam
 
Tokens, Complex Systems, and Nature
Tokens, Complex Systems, and NatureTokens, Complex Systems, and Nature
Tokens, Complex Systems, and Nature
Trent McConaghy
 
Apex for humans
Apex for humansApex for humans
Apex for humans
Kevin Poorman
 
Uses & Abuses of Mocks & Stubs
Uses & Abuses of Mocks & StubsUses & Abuses of Mocks & Stubs
Uses & Abuses of Mocks & StubsPatchSpace Ltd
 
It Probably Works - QCon 2015
It Probably Works - QCon 2015It Probably Works - QCon 2015
It Probably Works - QCon 2015
Fastly
 
Playfulness at Work
Playfulness at WorkPlayfulness at Work
Playfulness at Work
Erin Dees
 

Similar to The well tempered search application (20)

Webinar: Simpler Semantic Search with Solr
Webinar: Simpler Semantic Search with SolrWebinar: Simpler Semantic Search with Solr
Webinar: Simpler Semantic Search with Solr
 
Data Day Seattle, From NLP to AI
Data Day Seattle, From NLP to AIData Day Seattle, From NLP to AI
Data Day Seattle, From NLP to AI
 
From Natural Language Processing to Artificial Intelligence
From Natural Language Processing to Artificial IntelligenceFrom Natural Language Processing to Artificial Intelligence
From Natural Language Processing to Artificial Intelligence
 
Conf orm - explain
Conf orm - explainConf orm - explain
Conf orm - explain
 
Fluid, Fluent APIs
Fluid, Fluent APIsFluid, Fluent APIs
Fluid, Fluent APIs
 
Write better python code with these 10 tricks | by yong cui, ph.d. | aug, 202...
Write better python code with these 10 tricks | by yong cui, ph.d. | aug, 202...Write better python code with these 10 tricks | by yong cui, ph.d. | aug, 202...
Write better python code with these 10 tricks | by yong cui, ph.d. | aug, 202...
 
Ruby meetup evolution of bof search
Ruby meetup   evolution of bof search Ruby meetup   evolution of bof search
Ruby meetup evolution of bof search
 
Rocky Nevin's presentation at eComm 2008
Rocky Nevin's presentation at eComm 2008Rocky Nevin's presentation at eComm 2008
Rocky Nevin's presentation at eComm 2008
 
Introduction to Algorithms
Introduction to AlgorithmsIntroduction to Algorithms
Introduction to Algorithms
 
Extreme Swift
Extreme SwiftExtreme Swift
Extreme Swift
 
Drupal 8: A story of growing up and getting off the island
Drupal 8: A story of growing up and getting off the islandDrupal 8: A story of growing up and getting off the island
Drupal 8: A story of growing up and getting off the island
 
Algorithms
Algorithms Algorithms
Algorithms
 
Tokens, Complex Systems, and Nature
Tokens, Complex Systems, and NatureTokens, Complex Systems, and Nature
Tokens, Complex Systems, and Nature
 
All of javascript
All of javascriptAll of javascript
All of javascript
 
Apex for humans
Apex for humansApex for humans
Apex for humans
 
All of Javascript
All of JavascriptAll of Javascript
All of Javascript
 
Uses & Abuses of Mocks & Stubs
Uses & Abuses of Mocks & StubsUses & Abuses of Mocks & Stubs
Uses & Abuses of Mocks & Stubs
 
It Probably Works - QCon 2015
It Probably Works - QCon 2015It Probably Works - QCon 2015
It Probably Works - QCon 2015
 
Dynamic Python
Dynamic PythonDynamic Python
Dynamic Python
 
Playfulness at Work
Playfulness at WorkPlayfulness at Work
Playfulness at Work
 

Recently uploaded

Nidhi Software Price. Fact , Costs, Tips
Nidhi Software Price. Fact , Costs, TipsNidhi Software Price. Fact , Costs, Tips
Nidhi Software Price. Fact , Costs, Tips
vrstrong314
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
Google
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 

Recently uploaded (20)

Nidhi Software Price. Fact , Costs, Tips
Nidhi Software Price. Fact , Costs, TipsNidhi Software Price. Fact , Costs, Tips
Nidhi Software Price. Fact , Costs, Tips
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 

The well tempered search application

  • 1. The Well-Tempered Search Application Variations on a Theme: Why does my search app suck, and what can I do about it? Ted Sullivan – (old Phuddy Duddy) Senior (very much so I’m afraid) Solutions (I hope) Architect (and sometime plumber) Lucidworks Technical Services
  • 2. Our Basic Premises (Premisi?) • Lemma 1: Search Applications use algorithms that make finding chunks of text within large datasets possible in HTT (human-tolerable time). • Lemma 2: These algorithms work by breaking text into primitive components and building up a search “experience” from that. • Lemma 3: Lemma 2 is not sufficient to achieve Lemma 1.
  • 3. The Basic Disconnect • Text can be analyzed at the level of tokens (syntax) and at the level of meaning (semantics). • We think one way (semantics), search engines think another (syntax – i.e. token order). • How do we bridge the gap? … More clever algorithms!
  • 4. Art and Science • We need to be intelligent curators of these algorithms. Craftsmen (craftswomen?) that think of these as tools with a specific purpose. • Like any good craftsperson – we need a wide array of tools to get the job done (well almost).
  • 5. When is my search app done? • Quick answer: NEVER (ain’t consultin’ great?) • Long answer – As long as it is continues to improve, like fine wine or bourbon, you are on the path to enlightenment. • How do you get there grasshopper? Add semantic intelligence to the engine!
  • 6. Search cannot be shrink-wrapped!! What have we got for Donny behind Curtain #1 Jay? Well Monty - Heeeeeeeeeeeerrrrrrrreeeeesssss the Google … SEARCH Appliance!!!!
  • 7. Search cannot be shrink-wrapped!! What have we got for Donny behind Curtain #1 Jay? Well Monty - Heeeeeeeeeeeerrrrrrrreeeeesssss the Google … SEARCH Appliance!!!!* Sorry Donny – It’s a ZONK! * but Google Web Search has some Serious Mojo!
  • 8. Prelude part 1– The basic problem The inverted index and “bag-of-words” search: The red fox jumped over the fence. Time flies like an arrow. Fruit flies like a banana. the 1,6 red 2 fox 3 jumped 4 over 5 fence 7 flies 2,7 like 3,8
  • 9. Prelude part B – The Tried and True • Phrase and Proximity boosting and “Slop” • Synonyms and stop words • Stemming or Lemmatization • Autocomplete • Best Bets / Landing Pages – the sledgehammer • Spell check – spell suggest – aka the warm fuzzies.
  • 10. Fugue - Subject or Exposition Search engines need more ‘semantic awareness’ or at least the illusion of this. There is a heavy duty solution called Artificial Intelligence – which except in the fertile imagination of Hollywood screenwriters, is not there yet. So we need to fake it just a bit.
  • 11. Theme and Variations I autophrasing and the red sofa Theme: When multiple words mean just one thing. Fuzzy way: Boosting phrases (proximity and phrase slop) - pushes false positives down – i.e. out of the limelight - i.e. - shoves ‘em under the rug This encounters a problem with faceted search Like the eye of Sauron in LOTR or Santa Claus, the faceting engine SEES ALL (sins)! Brake Pads example: hit on things that have ‘brake’ (like children’s stroller brakes) and ‘pads’ – like mattress pads.
  • 12. Variation I: Autophrasing AutophrasingTokenFilter tells Lucene not to tokenize when a noun phrase represents a single thing - by providing a flat list of phrases. Creates one-to-one token mapping that Lucene prefers because it avoids the “sausagization” problem. https://github.com/LucidWorks/auto-phrase-tokenfilter
  • 13. income tax refund income tax tax refund “income tax” is not income. A “tax refund” is not a tax. Solution: Autophrasing + synonym mapping income tax => tax tax refund => refund Autophrasing Example
  • 14. Autophrasing Setup autophrases.txt: income tax tax refund tax rebate sales tax property tax synonyms.txt income_tax,property_tax,sales_tax,tax tax_refund,refund,rebate,tax_rebate <fieldType name="text_autophrase" class="solr.TextField" positionIncrementGap="100"> <analyzer type="index"> <tokenizer class="solr.StandardTokenizerFactory"/> <filter class="solr.LowerCaseFilterFactory"/> <filter class="com.lucidworks.analysis.AutoPhrasingTokenFilterFactory" phrases="autophrases.txt" includeTokens="true” replaceWhitespaceWith="_" /> <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" /> <filter class="solr.PorterStemFilterFactory"/> </analyzer> </fieldType>
  • 15. Multi-term synonym problem • New York, New York – it’s a HELLOVA town! Subject was inspired by an old JIRA ticket: Lucene-1622 “if multi-word synonyms are indexed together with the original token stream (at overlapping positions), then a query for a partial synonym sequence (e.g., “big” in the synonym “big apple” for “new york city”) causes the document to match” (or “apple” which will hit on my blog post if you crawl lucidworks.com !)
  • 16. This means certain phrase queries should match but don't (e.g.: "hotspot is down"), and other phrase queries shouldn't match but do (e.g.: "fast hotspot fi"). Other cases do work correctly (e.g.: "fast hotspot"). We refer to this "lossy serialization" as sausagization, because the incoming graph is unexpectedly turned from a correct word lattice into an incorrect sausage. This limitation is challenging to fix: it requires changing the index format (and Codec APIs) to store an additional int position length per position, and then fixing positional queries to respect this value. Sausagization: from Mike McCandless blog Changing Bits: Lucene's TokenStreams are actually graphs! http://blog.mikemccandless.com/2012/04/lucenes-tokenstreams-are-actually.html
  • 17. Multi-term synonym demo new york new york state empire state new york city new york new york big apple ny ny city of new york state of new york ny state autophrases.txt new_york => new_york_state,new_york_city,big_apple, new_york_new_york,ny_ny,nyc,empire_state,ny_state, state_of_new_york new_york_state,empire_state,ny_state, state_of_new_york new_york_city,big_apple,new_york_new_york,ny_ny,nyc, city_of_new_york synonyms.txt
  • 18. This document is about new york state. This document is about new york city. There is a lot going on in NYC. I heart the big apple. The empire state is a great state. New York, New York is a hellova town. I am a native of the great state of New York. new york new york city new york state Multi-term synonym demo /select /autophrase
  • 19. This document is about new york state. This document is about new york city. There is a lot going on in NYC. I heart the big apple. The empire state is a great state. New York, New York is a hellova town. I am a native of the great state of New York. empire state Multi-term synonym demo /select /autophrase (Even a blind squirrel finds a nut once in a while)
  • 20. Variation II: The Red Sofa Problem { "response":{"numFound":3,"start":0,"docs":[ { "color":"red", ”text":"This is the red sofa example. Please find with 'red sofa' query.", { "color":"red", ”text":"This is a red beach ball. It is red in color but is not something that you should not sit on because you would tend to roll off.", { "color":"blue", ”text":"This is a blue sofa, it should only hit on sofas that are blue in color."] }} OOTB – q=red sofa is interpreted as text:red text:sofa (default OR) http://localhost:8983/solr/collection1/select?q=red+sofa&wt=json
  • 21. Closing the Loop: Content Tagging and Intelligent Query Filtering Using the search index itself as the knowledge source:
  • 22. Solution for the Red Sofa problem Query Autofiltering: Search Index driven query introspection / query rewriting:
  • 23. Lucene FieldCache Magic Lucene FieldCache (to be renamed UninvertedIndex in Lucene 5.0) Inverted Index: Show all documents that have this term value in this field. Uninverted or Forward Index: Show all term values that have been indexed in this field. SolrIndexSearcher searcher = rb.req.getSearcher(); SortedDocValues fieldValues = FieldCache.DEFAULT.getTermsIndex( searcher.getAtomicReader( ), categoryField ); … StringTokenizer strtok = new StringTokenizer ( query, " .,:;"'" ); while (strtok.hasMoreTokens( ) ) { String tok = strtok.nextToken( ).toLowerCase( ); BytesRef key = new BytesRef( tok.getBytes() ); if (fieldValues.lookupTerm( key ) >= 0) {
  • 24. Query Autofiltering { "response":{"numFound":1,"start":0,"docs":[ { "id":"1", "color":"red", "description":"This is the red sofa example. Please find with 'red sofa' query."] } http://localhost:8983/solr/collection1/infer?q=red+sofa&wt=json Now search for “red sofa” only returns ….. red sofas! But – is this too “brute force”? The takeaway is that using the search index AS a knowledge store can be very powerful!
  • 25. Architecture: its all about Plumbing • Pipelines for every occasion. Indexing Pipelines – good ‘ole ETL - Content enrichment, tagging - Metadata cleanup Query Pipelines – identification, query preprocessing - introspection One is the “hand” the other, the “glove”
  • 26. Index Pipelines Lots of choices here: • Internal to Solr – DIH, UpdateRequestProcessor Pros and cons • External – Morphlines, Open Pipeline, Flume, Spark, Hadoop, Custom SolrJ • Lucidworks Fusion
  • 27. Entity and Fact Extraction Entities: Things, Locations, Dates, People, Organizations, Concepts Entity Relationships Company was acquired by Company Drug cures Disease Person likes Pizza Annotation Pipelines (UIMA, Lucidworks Fusion): Entity Extraction followed by Fact Extraction Pattern method: $Drug is used to treat $Condition Parts of Speech (POS) analysis Subject Predicate Object
  • 28. Theme and Variations II The Classification Wars • Machine Learning or Taxonomy – is it a Floor Wax or a Dessert Topping? Answer: It’s a floor wax AND a dessert topping! Its delicious and just look at that shine!
  • 29. Machine Learning Use mathematical vector-crunching algorithms like Latent Dirichlet Allocation (LDA), Bayesian Inference, Maximum Entropy, log likelihood, Support Vector Machines (SVM) etc., to find patterns and to associate those patterns with concepts. Can be supervised (i.e. given a training set) or unsupervised (the algorithm just finds clusters). Supervised learning are called semi-automatic classifiers. Check out Taming Text by Ingersoll, Morton and Farris (Manning)
  • 30. Machine Learning In LucidworksFusion Training Data NLP Trainer Stage NLP Model Test Data NLP Classifier Stage Classified Documents
  • 31. Taxonomy or Ontology “Knowledge graphs” that relate things and concepts to each other either hierarchically or associatively. Pros: Works without large amounts of content to analyze Encapsulates the knowledge of human subject matter experts Cons: Often not well designed for search (mixes semantic relationship types / organizational logic) Requires curation by subject matter experts whose time is costly
  • 32. Taxonomies Designed for Search Category nodes and Evidence nodes Category Node: A ‘parent’ node Can have child nodes that are: Sub Categories Evidence Nodes Evidence Node: Tends to be a leaf node (no children) Contains keyterms (synonyms) May contain “rules” e.g. (if contains term a and term b but not term c) Evidence Nodes can have more than one category node parent Hits on Evidence Nodes add to the cumulative score of a Category Node. Scores can be diluted as the accumulate up the hierarchy – so that the nearest category gets the strongest ‘vote’.
  • 33. US Corporations Foreign Corporations British Chinese French German Japanese Russian etc. Fortune 100 Companies Energy Financial Services Investment Banks Commercial Banks Health Care Health Insurance HMO Medical Devices Pharmaceuticals Hospitality Manufacturing Aircraft Automobiles Electrical Equipment
  • 34. Ford, GM, Chrysler Fortune 100 Companies Energy Financial Services Investment Banks Commercial Banks Health Care Health Insurance HMO Medical Devices Pharmaceuticals Hospitality Manufacturing Aircraft Automobiles Electrical Equipment US Corporations Foreign Corporations British Chinese French German Japanese Russian etc.
  • 35. Ford, GM, Chrysler,Toyota,BMW Fortune 100 Companies Energy Financial Services Investment Banks Commercial Banks Health Care Health Insurance HMO Medical Devices Pharmaceuticals Hospitality Manufacturing Aircraft Automobiles Electrical Equipment US Corporations Foreign Corporations British Chinese French German Japanese Russian etc.
  • 36. Fortune 100 Companies Energy Financial Services Investment Banks Commercial Banks Health Care Health Insurance HMO Medical Devices Pharmaceuticals Hospitality Manufacturing Aircraft Automobiles Electrical Equipment Ford, GM, Chrysler,Toyota,BMW GE, Boeing US Corporations Foreign Corporations British Chinese French German Japanese Russian etc.
  • 37. Fortune 100 Companies Energy Financial Services Investment Banks Commercial Banks Health Care Health Insurance HMO Medical Devices Pharmaceuticals Hospitality Manufacturing Aircraft Automobiles Electrical Equipment Ford, GM, Chrysler,Toyota,BMW GE, Boeing Bank of America, Hyatt US Corporations Foreign Corporations British Chinese French German Japanese Russian etc.
  • 38. Query Pipelines The ‘Wh’ Words: Who, What, When, Where Who are they (authentication)? What can they see (security - authorization)? When can they see it (entitlement)? What are they interested in (personalization / recommendation)? Where are they now (location)?
  • 39. Query Pipelines Inferential Search Query introspection -> Query modification. Query Autofiltering Are you feeling lucky today? Topic boosting / spotlighting Use ML to detect the topic, then boost and/or spotlight results tagged this way. Use a specialized collection to store ‘facet knowledge’
  • 40. The Art of the Fugue: Inferential Search • Infer what the user is looking for and give them that • Clever software infers meaning aka query “intent” • When we do this right, it appears to be magic!
  • 41. Machine Learning Drives Query Introspection Training Data NLP Trainer Stage NLP Model Test Data NLP Classifier Stage Classified Documents
  • 42. Machine Learning models can drive Query Introspection NL Query NLP Query Stage NLP Model Tagged Query Landing Page Boost Documents
  • 43. Da Capo al Coda • Killer search apps are crafted from fine ingredients and like fine whiskey will get better with age - if you are paying attention to ‘what’ your users are looking for. • Putting the pieces together requires an understanding of ‘what’ things, independent of what words they use to describe it.
  • 44. Thanks for your attention! Ted Sullivan Lucidworks, Technical Services ted.sullivan@lucidworks.com Skype: ted.sullivan5 LinkedIn Metuchen, New Jersey (You gotta problem with that?)

Editor's Notes

  1. ( * but the Google web app has some serious Mojo!)
  2. ( * but the Google web app has some serious Mojo!)
  3. Suga “Plague” story here – on Spell Check
  4. Sales tax is a type of tax, not a type of sale.
  5. Cue – Utube Video here
  6. Who are they? – Security – what can they see? Personalization – what do they like?