CBDW2-14Advance Website Search Techniques using Apache Solr & Google CSE

9

Click here to load reader

description

The goal of this session is to explore what can be done with CFSearch but expand what can be done with Apache Solr where CFSearch leaves off. However both systems will never have the same level of searching options as Google Custom Search Engine can do.I will explore how to get an internal search up and running within ColdBox, then how to jump outside of the box and expand to Solr Search for advance searching and sort. And finally use the power searching capabilities of Google and how to overlay Google's CSE information with Apache Solr's real-time information.Basically taking search within Coldbox to the next level providing custom searching, sorting, and real-time data access.Several assumptions you know how to setup a solr search you have a public facing website that is indexed by google you know how to get data into CFSearch or Solr Search Problems to solve - Google provides the best searching options however it will never be real-time enough to satisfy most needs. - By use of Apache Solr's JSON search engine - data can be spliced together providing the best of both worlds!"

Transcript of CBDW2-14Advance Website Search Techniques using Apache Solr & Google CSE

Page 1: CBDW2-14Advance Website Search Techniques using Apache Solr & Google CSE

Solr & Google CSEADVANCE WEB SEARCH TECHNIQUES

Page 2: CBDW2-14Advance Website Search Techniques using Apache Solr & Google CSE

About Me Jeremy DeYoung

Father of 3 kids

Entrepreneur

Founding Partner of Firearms For Sale & solo-developer

Working in ColdFusion since ‘97

And loving ColdBox since its verson 2.x days!

Page 3: CBDW2-14Advance Website Search Techniques using Apache Solr & Google CSE

Goals of the Presentation Overview of my Evolution of Website Search

◦ SQL ◦ CFSearch◦ Third-party client-side plugins

Overview Integration Google Custom Search◦ How to Sort, Filter, Bias using Custom Meta Data

Overview Integration of Apache Solr◦ Total Customization of Search◦ Faceting, grouping, search+browse+filter possible

Next, the good stuff… examples code & live demo of how it works

And finally, if we have time, a Q&A

Page 4: CBDW2-14Advance Website Search Techniques using Apache Solr & Google CSE

Early Days of Searching SELECT * FROM [table] WHERE [field] LIKE ‘%#searchterm#%’

CFCollection, CFIndex, & CFSearch

<cfquery name="MyQuery"> select pageID, PageText, PageDescription from MyPages</cfquery>

<cfindex collection= " MyCollection " action = "update" type= "custom" body= " PageText,PageDescription " query= " MyQuery " key= "pageID ">

<cfsearch name="searchResults" collection=" MyCollection" criteria=" fetch me a stick ">

<cfdump var="#searchResults#">

Page 5: CBDW2-14Advance Website Search Techniques using Apache Solr & Google CSE

Google Custom Search Engine The power of Google Search directly integrated within your website

Searching, Filtering, Bias, Sorting are possible

Integrate with XML/JSON or Javascript/Client Side script

The limitations is that you can’t group or facet your data and time to index is all in google’s hands.

In my opinion Google CSE is built to search non-product websites i.e. blogs, content, etc… but storefront websites work however very limited

Page 6: CBDW2-14Advance Website Search Techniques using Apache Solr & Google CSE

Solr Faceting of any field, range, both static and dynamic variable ranges

Filter of any search query both word specific & phrase specific boosting

Entire Field boosting i.e. categories, attributes, manufacturers, etc…

Pre-filtering on data import – 30+ prebuilt filters – powerful data import options

Pre-query filters

Replication, distribution, & clustering with SolrCloud support in the most recent version

Page 7: CBDW2-14Advance Website Search Techniques using Apache Solr & Google CSE

My Solr Limitations Limitations at the moment is the pre-term filtering must be done before Solr is involved i.e. via ColdFusion or other language. Version 5 will offer Javascript pre-term filtering & modification within Solr without the need of an interception. i.e. you can expose solr directly to the web.

For Example take the search phrase ::

sig 9mm 1911 pistol

And turn it into

sig +manufactuerID:888 9mm^10 1911 pistol +categoryID:2

Currently the only option I’ve found is to handle this thru code before solr is involved.

Page 8: CBDW2-14Advance Website Search Techniques using Apache Solr & Google CSE

And now onto Code!

Page 9: CBDW2-14Advance Website Search Techniques using Apache Solr & Google CSE