Implementing Autocomplete with Solr and jQuery

Slides:



Advertisements
Similar presentations
Lucene/Solr Architecture
Advertisements

* 1 Common Dialog Control. * 2 You want your user to set property or provide your application with some information easily? How do you do it? The Common.
 Apache Solr Apache Solr – Introduction David Shemer.
Web Applications Development Using Coldbox Platform Eddie Johnston.
Solr has a lot of extensive features Solr Integration and Enhancements Todd Hatcher.
Hello Vaadin! CS 3130 Summer 2015.
Copyright © Sequence Collective Ltd 2014 Content Search Using SOLR Copyright © Sequence Collective Ltd 2014 By: Dr. Ehab ElGindy Technical Team Lead Implementing.
LHCbPR V2 Sasha Mazurov, Amine Ben Hammou, Ben Couturier 5th LHCb Computing Workshop
The easy way to a nice looking website design By a total non-designer (Me!)
ICS 665 Jesse Abdul. jQuery UI Overview  jQuery UI javascript library Includes all UI component functionality  jQuery UI CSS framework Includes standard.
Database Updates Made Easy In WebFocus Using SQL And HTML Painter Sept 2011 Lender Processing Services 1.
JQuery. What is jQuery? jQuery is a fast, small, and feature-rich JavaScript library that simplifies HTML document traversing and manipulation event handling.
Implementing search with free software An introduction to Solr By Mick England.
Definition from Wikipedia.  The Prototype JavaScript Framework  implemented as a single file of JavaScript code  named prototype.js (
 jQuery Mobile An Introduction. What is jQuery Mobile  A framework built on top of jQuery, used for creating mobile web applications  Designed to make.
Search Search Drupal with Apache Solr with CERN Web Communications Group – Copyright 2013.
Project Rickshaw SEARCH - FIND - GO. Project Rickshaw TEAM MEMBERS KEVIN AUGUSTINO – MATT FOX – DAVID MOORE SPONSORS KARASU TECHNOLOGIES - ERIK PAUL -
Windows.Net Programming Series Preview. Course Schedule CourseDate Microsoft.Net Fundamentals 01/13/2014 Microsoft Windows/Web Fundamentals 01/20/2014.
WordPress Web. WordPress Blogging system with full content management Personal publishing system Built on PHP scripting language and MySQL relational.
PhpXperts What is jQuery Javascript Library Fast and concise Simplifies the interaction between HTML and JavaScript.
User Interface Design using jQuery Mobile CIS 136 Building Mobile Apps 1.
JavaScript & jQuery the missing manual Chapter 11
Battle of the Giants Apache Solr 4.0 vs ElasticSearch 0.20 Rafał Kuć – sematext.com.
AJAX Without the “J” George Lawniczak. What is Ajax?
VIVO Multi-site search Structure and function overview.
Revolutionizing enterprise web development Searching with Solr.
Lesson 19: Site Development with FrontPage 2003 – Advanced Features.
WaveMaker Visual AJAX Studio 4.0 Training Basics: Building Your First Application Binding Basics.
Wijmo Troy Taylor. What is Wijmo? -Wijmo is a kit of over 40 UI widgets, optimized for client-side web development. -HTML5 -jQuery -CSS3 -SVG.
State of Search Peter Buch – CSC EPA Web Workgroup Training Conference February 14, 2008 Potomac Yard Facility (Crystal City), Arlington, VA.
JQuery JavaScript is a powerful language but it is not always easy to work with. jQuery is a JavaScript library that helps with: – HTML document traversal.
807 - TEXT ANALYTICS Massimo Poesio Lab 2: (Quick intro to) SOLR Document clustering with MAHOUT.
WaveMaker Visual AJAX Studio 4.0 Training Java Script Events.
AJAX Use Cases for WSRP Subbu Allamaraju BEA Systems Inc WSRP F2F Meeting, May 2006.
Apache Solr Dima Ionut Daniel. Contents What is Apache Solr? Architecture Features Core Solr Concepts Configuration Conclusions Bibliography.
Developing Windows 8 Style Application With HTML and JavaScript Lino Tadros | Falafel Software.
JQuery form submission CIS 136 Building Mobile Apps 1.
LIMS SOLR Integration Jake Lin Shmulevich Lab
ArcGIS for Server Security: Advanced
Developing Windows 8 Style Application With HTML and JavaScript
JavaScript, Sixth Edition
Introduction to YouSeer
Building Intelligent Search Applications with Apache Solr and PHP5
Take a REST from manual searching: PDBe, programmatically
Section 13 - Integrating with Third Party Tools
AJAX and jQuery AJAX AJAX Concepts, XMLHttpRequest, jQuery AJAX: $.ajax(), $.get(), $.post() jQuery AJAX XMLHttpRequest SoftUni Team Technical Trainers.
Data Virtualization Tutorial… CORS and CIS
Play Framework: Introduction
Usability vs. Purity: How UCSF and Duke Enabled Data Reuse By Going Beyond Linked Data Julia Trimmer, Anirvan Chatterjee, Eric Meeks, Richard Outten and.
JQuery UI.
User Interface Design and Usability jQuery, jQuery UI & jQuery Plugins
Tutorial 6 Topic: jQuery and jQuery Mobile Li Xu
JQUERY Online TRAINING AT GOLOGICA
Virginia Tech, Blacksburg, VA 24061
CS 5604 Information Storage and Retrieval
CS6604 Digital Libraries IDEAL Webpages Presented by
jQuery form submission
Chapter 11 - How to use jQuery plugins and jQuery UI Widgets
Phonegap Bridge Configuration file
Master a Skill / Learn for Life
Introduction to Nutch Zhao Dongsheng
SEEM4570 Tutorial 5: jQuery + jQuery Mobile
Lucene/Solr Architecture
jQuery Widgets: Tabs Requires core jQuery library + jQuery UI
Getting Started With Solr
CS5220 Advanced Topics in Web Programming Angular – Services
Web-Applications & AJAX
Battle of the Giants Apache Solr 4.0 vs ElasticSearch 0.20
Chengyu Sun California State University, Los Angeles
Chengyu Sun California State University, Los Angeles
Presentation transcript:

Implementing Autocomplete with Solr and jQuery Magic Made Easy by Paul Oakes 1

Objectives Find Solr/Lucene project jQuery autocomplete Configure schema.xml, solrconfig.xml jQuery autocomplete plugin Search API workaround for jQuery Run Solr searching

What is Autocomplete in Solr? Solr-1316: Autosuggest https://issues.apache.org/jira/browse/SOLR-1316 Based on spellcheck http://wiki.apache.org/solr/SpellCheckComponent Ternary Search Trie http://www.javaworld.com/javaworld/jw-02-2001/jw-0216-ternary.html A Ternary Search Trie is a data structure for storing strings that is ideal for practical use in sorting and searching data. Let's get started! 3

Find SOLR-1316 Patches Solr/Lucene from Apache https://issues.apache.org/jira/browse/SOLR-1316 Solr/Lucene from Apache http://svn.apache.org/repos/asf/lucene/dev/trunk/ Trunk has Autosuggest already built in 4

Find jQuery http://jqueryui.com/demos/autocomplete/#remote http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.3/ jquery-ui.js themes/base/jquery-ui.css http://dev.jquery.com/view/trunk/plugins/autocomplete/jquery.autocomplete. css

What to Autocomplete? “Who's your data?”

What to autocomplete? What is searchable in the index? What data is useful to autocomplete? Lets look at the document data

Data, Documents and Fields <field name="id">SOLR026</field> <field name="categories">Computers</field> <field name="categories">Solr</field> <field name="categories">Search</field> <field name="authors">ASF</field> <field name="description"></field> <field name="average_rating">5.0</field> <field name="sales_rank">100</field> <field name="title">Solr Enterprise Search</field> </doc> 8

Configure schema.xml solrconfig.xml URL parameters 9

Configure schema.xml http://wiki.apache.org/solr/SchemaXml Lives in $SOLR_HOME/conf Field Types Defines datatypes, tokenizers and filters. Fields Defines the fields that are stored in the search index. Copy Fields Instruction to copy value of one defined field in to another. Autocomplete uses copyField(s.) 10

Configure schema.xml <fields> <field name="authors" type="textgen" indexed="true" stored="true" multiValued="true"/> <field name="title" type="textgen" indexed="true" stored="true"/> <field name="categories" type="textgen" indexed="true" stored="true" multiValued="true"/> <field name="autocomplete-field" type="string" </fields> 11

Configure schema.xml <copyField source="authors" dest="autocomplete-field"/> <copyField source="title" <copyField source="categories" 12

Configure solrconfig.xml http://wiki.apache.org/solr/SolrConfigXml Lives in $SOLR_HOME/conf Defines Index defaults, deletion policy Update handlers Caches Event listeners, e.g. new and first searchers Request handlers (API) Search components Response writers 13

Configure solrconfig.xml Search Component <searchComponent name="spellcheck-autocomplete" class="solr.SpellCheckComponent"> <lst name="spellchecker"> <str name="name">suggest</str> <str name="classname"> org.apache.solr.spelling.suggest.Suggester </str> <str name="lookupImpl"> org.apache.solr.spelling.suggest.jaspell.JaspellLookup <str name="field">autocomplete-field</str> <str name="sourceLocation">american-english</str> </lst> </searchComponent> 14

Configure Configure solrconfig.xml Request Handler <requestHandler name="/autocomplete" class="solr.SearchHandler"> <arr name="components"> <str>spellcheck-autocomplete</str> </arr> </requestHandler>

Configure Autocomplete URL: Important parameters spellcheck=true http://antikythera- 3.local:8983/solr/autocomplete?spellcheck=true&spellcheck. dictionary=suggest&spellcheck.extendedResults=true&spellc heck.count=100&spellcheck.build=true&q=s Important parameters spellcheck=true spellcheck.build=true spellcheck.dictionary=suggest

Run Build and run Solr Add documents Populate autocomplete search component Demonstration of autocomplete 17

Configure HTML jQuery

Configure HTML <div class="demo"> <div class="ui-widget-search ui-widget"> Search: <br /> <input id="search" class="searchInput"/> </div> <div class="ui-widget-results ui-widget"> Results: <div id="results" style="overflow: auto;" class="ui-widget-content"></div> 19

Configure jQuery autocomplete plugin options $( "#search" ).autocomplete({ minLength: 1, delay:10, source: function(request, response) { minLength: min. typed characters delay: millisecond keystroke delay source: data to use, can be array, string or callback disabled 20

Configure jQuery autocomplete plugin events $( "#search" ).autocomplete({ select: function( event, ui ), focus: function( event, ui ) Both events add ajax results to #results

Configure jQuery Cross Site Scripting blocking: Cross Site Scripting prevention in jQuery includes port! Test going directly to Solr - will get "Canceled opening the page” Work around: proxy API for jQuery to Solr 22

Run Build and run jQuery Web App & Solr Add documents Demonstration of autocomplete 23

Review Find Solr/Lucene project jQuery autocomplete Configure http://svn.apache.org/repos/asf/lucene/dev/trunk/ jQuery autocomplete http://jqueryui.com/demos/autocomplete/#remote Configure schema.xml, solrconfig.xml jQuery autocomplete plugin Search API workaround for jQuery Run JQuery and Solr 24

Thank You Questions? Contact me: poakes@lulu.com