SlideShare a Scribd company logo
1 of 16
MongoLantern - Fulltext Search Server From Presented By: Sougata Pal (Skall) [email_address] February 12, 2012  Download Link:  http://sourceforge.net/projects/mongolantern/
Introduction to MongoLantern MongoLantern is an open source full text search server using MongoDB as index storage, which allows MongoLantern to migrate any changes very easily into account using MongoDB API. It's written originally written in PHP can be migrated to any desired language as required using it's future APIs. Basic Features: Token based search algorithm, Case insensitive Fulltext search, Different Search match mode, Field based search algorithms, Pre-built Index support. Note:  MongoLantern is also listed in trusted apps in MongoDB official site, you can check it  here . MongoLantern - Fulltext Search Server
MongoLantern Latest Release Notes (Version: 0.7) 1.  Namespaces updated. 2.  ErrorReporting type update handler added. [user: prodigyview] 3.  CSV Indexer finalized. MongoLantern - Fulltext Search Server
Class: MongoLanternIndexer Functional Guide: MongoLanternIndexer::$indexName :  Set Index name on MongoDB MongoLanternIndexer::dictionaryEnabled() : Enable or disable dictonary: true / false.  default: true. This  method must be called before  MongoLanternIndexer::Connect() MongoLanternIndexer::Connect() : Connect to MongoLantern target Index MongoLanternIndexer::setFields() : Set fields to be searched later. On this field list the index  will be optimized. MongoLanternIndexer::setDocument() : Set document to MongoLantern Indexer instance to commit to index. MongoLanternIndexer::Commit() : Save dataset to index for searching. MongoLanternIndexer::Optimize() : Optimize Index with few required fields & also fields  specified by MongoLanternIndexer::setFields() MongoLanternIndexer::totalDocs() : Get total number of documents available on index. MongoLanternIndexer::validateDocumentID() : Check for document existance with documentID. MongoLanternIndexer::dropFieldIndex() : Remove any pre-built field Index specified by  MongoLanternIndexer::setFields().  Note that the required  indexes must not be deleted, which may cause issue in  search.
Class: MongoLanternDocument Functional Guide: MongoLanternDocument::setField() :  Set fields to document instance to pass to MongoLanternIndexer::setDocument() Class: MongoLanternField Functional Guide: MongoLanternField::Keyword() :  Set field which will required to be used as Keyword for search, this  field value will not be tokenized and will be used as search term as  a whole. e.g . Books ISBN number MongoLanternField::Text() :  TEXT content must be tokenized OR used as tokenized data as  tokens. Also keep the whole content into index for field level filter. e.g . Blog posts title MongoLanternField::UnStored() :  This field value will only be tokenized and but will not be stored to  index as a whole. You can't run subquery on this field. e.g.  Blog posts body MongoLanternField::UnIndexed() :  UnIndexed content must not be tokenized OR used as tokens.  Just keep the content into index. This can be used for sorting or  subquery. e.g.  Blog post author MongoLanternField::Binary() :  BINARY content must not be tokenized OR used as tokens. Just  keep the content into index. Not implemented yet.
Class: MongoLanternQuery Functional Guide: MongoLanternQuery::$indexName :  Set Index name on MongoLantern MongoLanternQuery::$debug :  true / false. It enables or disables the debug mode. If  enabled it will print the debug data but no results could be  obtained. MongoLanternIndexer::Connect() : Connect to MongoLantern target Index MongoLanternIndexer::setQuery() : Set keyword for search. MongoLanternIndexer::setMatchMode() : Set result match mode for search. There are 3 types of  Query Mode: BESTMATCH, SUGGESTED, ANY MongoLanternIndexer::setSortMode() : Set result sorting mode for returing results. There are 3  types of Sorting Mode: RANK, CREATED, DOCUMENT MongoLanternIndexer::setLimit() : Limit the result. MongoLanternIndexer::setSkip() : Paginate the result along with  MongoLanternIndexer::setLimit() MongoLanternIndexer::setIntelligentQueryMode() : Resolve parital query typo as mentioned in release notes. MongoLanternIndexer::Execute() : Execute the query and result results. MongoLanternIndexer::getStats() : Get query execution stats. MongoLanternIndexer::Clear() : Destroy MongoLanternQuery instance .
3 rd  Party Class: MongoLanternIndexCSV Functional Guide: MongoLanternQuery::dictionaryEnabled() :  Enable or Disable dictionary support for CSV indexer. MongoLanternQuery::setCSV() :  Set valid CSV file or CSV String. MongoLanternIndexer::setFields() : Set fields to be indexed and optimize. MongoLanternIndexer::setDocumentIDField() : Set field for unique documentID which exists in CSV. MongoLanternIndexer::setFieldsType() : Set fields type for best index & results. MongoLanternIndexer::Commit() : Save document to MongoLantern Index. * Note:  Please use Examples/CSV/CSVIndexer.php to test CSV indexer. The search mechanism is same  as genral indexer.
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
How to create fulltext search index with MongoLantern ? # Creating/Updating a New Index(continue...) * Current Advanced Method: $docObj = new MongoLanternDocument(); $docObj->setField(MongoLanternField::Keyword('email', $doc['email']))   ->setField(MongoLanternField::Text('firstname', $doc['firstname']))   ->setField(MongoLanternField::UnStored('lastname', $doc['lastname']))    ->setField(MongoLanternField::UnIndexed('age', $doc['age']))   ->setField(MongoLanternField::UnIndexed('height', $doc['height']))   ->setField(MongoLanternField::UnIndexed('joined_on', $doc['joined_on'])); $indexer->setDocument($uniqueIndexID, $docObj); Note: To update data into mongolantern index you must pass the correct value of $uniqueIndexID to the  function. The document will be identified via this unique ID. Also note that the new document object method is backward compatible so you can always index using  array instead using document object. Using array is highly discouraged due to result quality issue.
How to create fulltext search index with MongoLantern ? # Creating/Updating a New Index(continue...) $indexer->Commit(); Note: Data will only be stored to index if and only if you commit it. $indexer->Optimize(); Note: MongoLanternIndexer::Optimize() is used to set indexes on the fields specifiedvia setFields. It will also  created default search & sort indexes.
How to validate a document from index with DocumentID ? # Creating/Updating a New Index(continue...) $indexer->validateDocumentID($docID); Note: This will check whether the documentID suppiled exists into index. Output type is boolean. Success:  true Failure:  false Now you can also get info on total available docs into the index. $indexer->totalDocs();
How to search from pre-built index with MongoLantern ? # Searching an Index $search = new MongoLanternQuery(); $search->indexName = 'People'; $search->Connect(); $search->setQuery($keyword); $search->setMatchMode('BESTMATCH'); Note: There are 3 types of Query Mode: RANK, CREATED, DOCUMENT yet. $search->setSortMode('RANK'); Note: There are 3 types of Query Mode: RANK, CREATED, DOCUMENT yet. $search->setIntelligentQueryMode(true); Note: Resolve parital query typo detection. e.g. Search Term: millban tower will return you "Millbank Tower" from Place index. Search Term: "markku nikkane" will return you "Markku Nikkanen" from People index. Use of this kind of query is highly discouraged for larger databases. MongoLantern team is trying to optimize it.
How to search from pre-built index with MongoLantern ? # Searching an Index(continue...) $resultList = $search->Execute(); print_r ( $resultList ); Array ( [0] => Array   ( [_id] => MongoId Object ( [$id] => 4f106729293d861805000018 ) [documentID] => 8 [document] => Array ( [firstname] => subhajit [lastname] => mjee [email] => subhajit@techunits.com [age] => 25 [height] => 6.1 [joined_on] => 23 ) [created] => 1326904795 [phraseDistanceRank] => 30 ) )
How to search from pre-built index with MongoLantern ? # Searching an Index(continue...) print_r ( $search->getStats() ); Array ( [executionTime] => Array ( [query] => 0.004927 [sort] => 0.0023660000000001 [total] => 0.0072930000000001 ) [resultsCount] => 2 ) Note:  MongoLanternQuery:: getStats() must be called after  MongoLanternQuery::Execute(). It will just return    the stats info for the last query.
How to search from pre-built index with MongoLantern ? # Query Construction API MongoLatern is also having support for query construction via subquery & range query methods. Example as  follows: $parser = new MongoLanternQueryParser(); $parser->setQueryTerm('techunits'); $parser->setSubqueryTerm('email', 'techunits.com', false); Note: 3 rd  parameter to the MongoLanternQueryParser::setSubqueryTerm() is used to specify whether  the match mode will be exact or partial match. true:  enable exact match False: enable partial match e.g.   If “false” then it will match techunits.com to any email address containing techunits.com in the above  example. $parser->setRange('height', 5.0, 6.0); Finally the the Query parser object instance can be passed to MongoLanternQuery::setQuery(). $search->setQuery($parser);
Thank you using MongoLantern Developer's Email:   [email_address] Community Discussion: [email_address] Download Link:  http://sourceforge.net/projects/mongolantern/ MongoLantern - Fulltext Search Server

More Related Content

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 

Featured

Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Featured (20)

AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 

MongoLantern - MongoDB Fulltext Search Server

  • 1. MongoLantern - Fulltext Search Server From Presented By: Sougata Pal (Skall) [email_address] February 12, 2012 Download Link: http://sourceforge.net/projects/mongolantern/
  • 2. Introduction to MongoLantern MongoLantern is an open source full text search server using MongoDB as index storage, which allows MongoLantern to migrate any changes very easily into account using MongoDB API. It's written originally written in PHP can be migrated to any desired language as required using it's future APIs. Basic Features: Token based search algorithm, Case insensitive Fulltext search, Different Search match mode, Field based search algorithms, Pre-built Index support. Note: MongoLantern is also listed in trusted apps in MongoDB official site, you can check it here . MongoLantern - Fulltext Search Server
  • 3. MongoLantern Latest Release Notes (Version: 0.7) 1. Namespaces updated. 2. ErrorReporting type update handler added. [user: prodigyview] 3. CSV Indexer finalized. MongoLantern - Fulltext Search Server
  • 4. Class: MongoLanternIndexer Functional Guide: MongoLanternIndexer::$indexName : Set Index name on MongoDB MongoLanternIndexer::dictionaryEnabled() : Enable or disable dictonary: true / false. default: true. This method must be called before MongoLanternIndexer::Connect() MongoLanternIndexer::Connect() : Connect to MongoLantern target Index MongoLanternIndexer::setFields() : Set fields to be searched later. On this field list the index will be optimized. MongoLanternIndexer::setDocument() : Set document to MongoLantern Indexer instance to commit to index. MongoLanternIndexer::Commit() : Save dataset to index for searching. MongoLanternIndexer::Optimize() : Optimize Index with few required fields & also fields specified by MongoLanternIndexer::setFields() MongoLanternIndexer::totalDocs() : Get total number of documents available on index. MongoLanternIndexer::validateDocumentID() : Check for document existance with documentID. MongoLanternIndexer::dropFieldIndex() : Remove any pre-built field Index specified by MongoLanternIndexer::setFields(). Note that the required indexes must not be deleted, which may cause issue in search.
  • 5. Class: MongoLanternDocument Functional Guide: MongoLanternDocument::setField() : Set fields to document instance to pass to MongoLanternIndexer::setDocument() Class: MongoLanternField Functional Guide: MongoLanternField::Keyword() : Set field which will required to be used as Keyword for search, this field value will not be tokenized and will be used as search term as a whole. e.g . Books ISBN number MongoLanternField::Text() : TEXT content must be tokenized OR used as tokenized data as tokens. Also keep the whole content into index for field level filter. e.g . Blog posts title MongoLanternField::UnStored() : This field value will only be tokenized and but will not be stored to index as a whole. You can't run subquery on this field. e.g. Blog posts body MongoLanternField::UnIndexed() : UnIndexed content must not be tokenized OR used as tokens. Just keep the content into index. This can be used for sorting or subquery. e.g. Blog post author MongoLanternField::Binary() : BINARY content must not be tokenized OR used as tokens. Just keep the content into index. Not implemented yet.
  • 6. Class: MongoLanternQuery Functional Guide: MongoLanternQuery::$indexName : Set Index name on MongoLantern MongoLanternQuery::$debug : true / false. It enables or disables the debug mode. If enabled it will print the debug data but no results could be obtained. MongoLanternIndexer::Connect() : Connect to MongoLantern target Index MongoLanternIndexer::setQuery() : Set keyword for search. MongoLanternIndexer::setMatchMode() : Set result match mode for search. There are 3 types of Query Mode: BESTMATCH, SUGGESTED, ANY MongoLanternIndexer::setSortMode() : Set result sorting mode for returing results. There are 3 types of Sorting Mode: RANK, CREATED, DOCUMENT MongoLanternIndexer::setLimit() : Limit the result. MongoLanternIndexer::setSkip() : Paginate the result along with MongoLanternIndexer::setLimit() MongoLanternIndexer::setIntelligentQueryMode() : Resolve parital query typo as mentioned in release notes. MongoLanternIndexer::Execute() : Execute the query and result results. MongoLanternIndexer::getStats() : Get query execution stats. MongoLanternIndexer::Clear() : Destroy MongoLanternQuery instance .
  • 7. 3 rd Party Class: MongoLanternIndexCSV Functional Guide: MongoLanternQuery::dictionaryEnabled() : Enable or Disable dictionary support for CSV indexer. MongoLanternQuery::setCSV() : Set valid CSV file or CSV String. MongoLanternIndexer::setFields() : Set fields to be indexed and optimize. MongoLanternIndexer::setDocumentIDField() : Set field for unique documentID which exists in CSV. MongoLanternIndexer::setFieldsType() : Set fields type for best index & results. MongoLanternIndexer::Commit() : Save document to MongoLantern Index. * Note: Please use Examples/CSV/CSVIndexer.php to test CSV indexer. The search mechanism is same as genral indexer.
  • 8.
  • 9. How to create fulltext search index with MongoLantern ? # Creating/Updating a New Index(continue...) * Current Advanced Method: $docObj = new MongoLanternDocument(); $docObj->setField(MongoLanternField::Keyword('email', $doc['email'])) ->setField(MongoLanternField::Text('firstname', $doc['firstname'])) ->setField(MongoLanternField::UnStored('lastname', $doc['lastname'])) ->setField(MongoLanternField::UnIndexed('age', $doc['age'])) ->setField(MongoLanternField::UnIndexed('height', $doc['height'])) ->setField(MongoLanternField::UnIndexed('joined_on', $doc['joined_on'])); $indexer->setDocument($uniqueIndexID, $docObj); Note: To update data into mongolantern index you must pass the correct value of $uniqueIndexID to the function. The document will be identified via this unique ID. Also note that the new document object method is backward compatible so you can always index using array instead using document object. Using array is highly discouraged due to result quality issue.
  • 10. How to create fulltext search index with MongoLantern ? # Creating/Updating a New Index(continue...) $indexer->Commit(); Note: Data will only be stored to index if and only if you commit it. $indexer->Optimize(); Note: MongoLanternIndexer::Optimize() is used to set indexes on the fields specifiedvia setFields. It will also created default search & sort indexes.
  • 11. How to validate a document from index with DocumentID ? # Creating/Updating a New Index(continue...) $indexer->validateDocumentID($docID); Note: This will check whether the documentID suppiled exists into index. Output type is boolean. Success: true Failure: false Now you can also get info on total available docs into the index. $indexer->totalDocs();
  • 12. How to search from pre-built index with MongoLantern ? # Searching an Index $search = new MongoLanternQuery(); $search->indexName = 'People'; $search->Connect(); $search->setQuery($keyword); $search->setMatchMode('BESTMATCH'); Note: There are 3 types of Query Mode: RANK, CREATED, DOCUMENT yet. $search->setSortMode('RANK'); Note: There are 3 types of Query Mode: RANK, CREATED, DOCUMENT yet. $search->setIntelligentQueryMode(true); Note: Resolve parital query typo detection. e.g. Search Term: millban tower will return you "Millbank Tower" from Place index. Search Term: "markku nikkane" will return you "Markku Nikkanen" from People index. Use of this kind of query is highly discouraged for larger databases. MongoLantern team is trying to optimize it.
  • 13. How to search from pre-built index with MongoLantern ? # Searching an Index(continue...) $resultList = $search->Execute(); print_r ( $resultList ); Array ( [0] => Array ( [_id] => MongoId Object ( [$id] => 4f106729293d861805000018 ) [documentID] => 8 [document] => Array ( [firstname] => subhajit [lastname] => mjee [email] => subhajit@techunits.com [age] => 25 [height] => 6.1 [joined_on] => 23 ) [created] => 1326904795 [phraseDistanceRank] => 30 ) )
  • 14. How to search from pre-built index with MongoLantern ? # Searching an Index(continue...) print_r ( $search->getStats() ); Array ( [executionTime] => Array ( [query] => 0.004927 [sort] => 0.0023660000000001 [total] => 0.0072930000000001 ) [resultsCount] => 2 ) Note: MongoLanternQuery:: getStats() must be called after MongoLanternQuery::Execute(). It will just return the stats info for the last query.
  • 15. How to search from pre-built index with MongoLantern ? # Query Construction API MongoLatern is also having support for query construction via subquery & range query methods. Example as follows: $parser = new MongoLanternQueryParser(); $parser->setQueryTerm('techunits'); $parser->setSubqueryTerm('email', 'techunits.com', false); Note: 3 rd parameter to the MongoLanternQueryParser::setSubqueryTerm() is used to specify whether the match mode will be exact or partial match. true: enable exact match False: enable partial match e.g. If “false” then it will match techunits.com to any email address containing techunits.com in the above example. $parser->setRange('height', 5.0, 6.0); Finally the the Query parser object instance can be passed to MongoLanternQuery::setQuery(). $search->setQuery($parser);
  • 16. Thank you using MongoLantern Developer's Email: [email_address] Community Discussion: [email_address] Download Link: http://sourceforge.net/projects/mongolantern/ MongoLantern - Fulltext Search Server