Solr
From Cyclone3 Wiki
(Difference between revisions)
(→Examples) |
(→Enable) |
||
Line 1: | Line 1: | ||
Apache Solr is document fulltext search engine integrated in Cyclone3 | Apache Solr is document fulltext search engine integrated in Cyclone3 | ||
- | = | + | = Configuration = |
Add line with Solr url into [[TOM.conf]] | Add line with Solr url into [[TOM.conf]] | ||
Line 7: | Line 7: | ||
$Ext::Solr::url='http://localhost:8080/solr'; | $Ext::Solr::url='http://localhost:8080/solr'; | ||
+ | Copy special Cyclone3 schema.xml to solr configuration From: | ||
+ | |||
+ | ${CYCLONE3_PATH}/_addons/Ext/Solr/schema.xml | ||
= Examples = | = Examples = |
Revision as of 12:14, 21 April 2012
Apache Solr is document fulltext search engine integrated in Cyclone3
Contents |
Configuration
Add line with Solr url into TOM.conf
$Ext::Solr::url='http://localhost:8080/solr';
Copy special Cyclone3 schema.xml to solr configuration From:
${CYCLONE3_PATH}/_addons/Ext/Solr/schema.xml
Examples
Basic use and variables
my $solr = Ext::Solr::service(); my $response = $solr->search(...); my $score_max=$response->content->{'response'}->{'maxScore'}; my $rows=$response->content->{'response'}->{'numFound'}; for my $doc ( $response->docs ) { my $id=$doc->value_for('id'); my $title=$response->content->{'highlighting'}->{$id}->{'title'}[0] || $doc->value_for('title'); }
Search in articles and boost score of newer items
my $boost='recip(ms(NOW/HOUR,last_modified),3.16e-11,1,1)'; my $response = $solr->search( "{!boost b=$boost} ".$query, { 'rows' => 10, 'defType' => 'dismax', 'mm' => "100%", 'bq' => '+id:example_tld.a401_article.sk.*', 'qf' => "title^1.2 description^0.8 keywords^0.5 text^0.2", 'fl' => "id ID_entity_i title description text score last_modified", 'hl' => "true" , 'hl.fl' => "title description", 'hl.fragsize' => "400" } );