• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Mastering solr
 

Mastering solr

on

  • 2,563 views

Mastering Solr will give an introduction to the more advanced use of Solr. It offers a starting point to go beyond the possibilies offered by the Solr integration modules. ...

Mastering Solr will give an introduction to the more advanced use of Solr. It offers a starting point to go beyond the possibilies offered by the Solr integration modules.

The following subjects will be covered:

- Getting Solr running locally
- Integration modules: Search API vs ApacheSolr
- Configuring an index
- Search relevancy: basic boosting of search results.
- The anatomy of a request to Solr
- Hooks for altering/adding parameters to the request to Solr
- Search relevancy: advanced date boosting by boost functions
- Search relevancy: advanced boosting by boost queries

Statistics

Views

Total Views
2,563
Views on SlideShare
2,532
Embed Views
31

Actions

Likes
0
Downloads
0
Comments
0

3 Embeds 31

http://localhost 29
https://si0.twimg.com 1
https://twitter.com 1

Accessibility

Categories

Upload Details

Uploaded via as OpenOffice

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Mastering solr Mastering solr Presentation Transcript

    • Mastering solr Jur de Vries
    • Who am I?Developer/architect at TriquantaTrainer at Wizzlern
    • Use caseMarket placeAdvertisementsAdjust relevancyPaid boosting of addsOf course we use Drupal and Apache Solr
    • Running Solr LocallyDownload latest version (3.6)Be sure to download distribution (not src)Unpack solrGo to example directoryRun java -jar start.jar
    • Drupal: which contrib?2 Possibilities Apachesolr search Search api with solr backend
    • Apache solr searchStreghts: Supported by Acquia Easy to set up MatureWeaknesses Integration with views (still in dev)
    • Search ApiStrengths Flexible Indexes all entities Excellent views integration Related fields are easy to add to indexWeaknesses Not supported (yet) by Acquia Solr backend has some issues
    • Drupal: which contrib?Apachesolr search integration Quick setup AcquiaSearch API Exportable configuaration Views integration Index all entitiesDepends on your needs
    • Basic use of search apiCreate serverCreate index Select fields to index Define data alterations Define processorsStart indexing
    • Field typesInteger, date, booleanString or fulltext? Fulltext will get processed! Tokenize Stopwords Ignore case String is as is
    • DemoRun solrCopy schema.xml and solrconfig.xml (!)Create serverCreate indexCreate view ads Ad filter exposed: search
    • Advanced use of Search apiThis talk is about Solr, not about search APIUnderstand Solr first!Many resources on the webWatch screencasts etc
    • Mastering SolrMastering solr is understanding solrWhat happens after a Drupal module?Lets have a look at the request
    • Solr requestLook at solr logParameters: start rows q (query) qf (query fields) fl (fields) fq (filter query)
    • Field namesitem_id, idt_.., ss_.., → why?Solr has to know how to handle fieldsField api: field names differDynamic field names: tell solr field type!
    • Schema.xmlDefines field types and fieldsThe real tweaking starts here!Lets have a look! dynamicField field type analyzersCopyfield
    • What can you do in schema.xml?Synonyms (is disabled by default)Stopwords (and, or, etc)StemmingProper multilingual handling
    • Browse the schemaSolr offers schema browsingGo to: http://localhost:8983/solr/admin
    • Search relevancyTypes of boosting: Field level boost Boost function Boost query (QueryElevation)
    • Boost parametersField level boosting: qf qf:t_body^20 score in field is multiplied by 20Boost function: bf bf:product(fieldname, 2) result of function is added to scoreBoost query: bqboost (only for edismax) like bf but multiplication
    • Lets boost titleField level boost is incorporated in Search API...But, where are the numbers in the request???Search api solr forgot to add them!There is a patch :-)But lets do it another way...
    • Debugging SolrLets add &echoParams=all to the request...Where do all these parameters come from?Solrconfig.xml!!!Among other things: request handlerLets look at the dismax request handler
    • Solrconfig.xml(Default) Request handler: Default parameters Add Spellcheck Tweak all kinds of search behavior! Lets add default search fields with boost
    • Boost functionMathematical functions on field valuesAvailable functions: sum(x,y): x + y product(x,y): x * y scale(x, minTarget, maxTarget) recip(x, m, a, b): x / (m * a + b) ms(): time → ms(NOW/DAY, created) Many more!
    • Boost dateWe need ms(): big values!Linear? To much differenceRecip!recip(x,1,1000,1000)if x 1000: half1 year: 3.1e10recip(ms(NOW/YEAR?, created),1,3.1e10,3.1e10)bf=recip(ms(NOW/YEAR?, created),1,3.1e10,3.1e10)^3Use a graphing tool!
    • Boost queriesDo a query like fq:Boost adds: content_type:add bq=content_type:add bq=(content_type)^20
    • Debugging relevancyWe know how to boostHow can finetuning be done?solr has the solutions: add debugQuery=on
    • debugQuery=onnormal source
    • RelevancyChoose your boosting methodsTry in your browserFinetuning: debugQuery=on, sourceAdd parameters to solrconfig.xmlOr...
    • Add parameters in codeusehook_search_api_solr_query_alter(array &$call_args, SearchApiQueryInterface $query)$call_args[params][bq] = (t_title:foo)^20$call_args[params][bf][] = b_promote
    • Override solr service classIn Search API: define server classextend solr service classOnly change key methodsIts all about passing parameters!
    • ConclusionTweak indexing in schema.xml Stopwords MultilingualTweak searching in solrconfig.xmlTweak searching by passing variablesThis is only an introduction!
    • Questions?
    • Feedback & follow-up:http://drupalcampgent.be/feedback