SlideShare uma empresa Scribd logo
1 de 15
SOLR + Search API
Facets API
1. Installation of SOLR
1.1 Open console. Start install solr with jetty for web-server:
sudo apt-get -y install openjdk-7-jdk
cd /opt
wget http://archive.apache.org/dist/lucene/solr/4.7.2/solr-4.7.2.tgz
tar -xvf solr-4.7.2.tgz
cp -R solr-4.7.2/example /opt/solr
cd /opt/solr
java -jar start.jar
After this we can check if all works on http://YOUR_IP:8983/solr. After this we need to close app in console with
Ctrl+C.
1. Installation of SOLR
1.2 Open console. Start configuring /etc/default/jetty:
nano /etc/default/jetty
Add this settings to this file:
NO_START=0
JAVA_OPTIONS="-Dsolr.solr.home=/opt/solr/solr $JAVA_OPTIONS"
JAVA_HOME=/usr/java/default
JETTY_HOME=/opt/solr
JETTY_USER=solr
JETTY_LOGS=/opt/solr/logs
Save file!
1. Installation of SOLR
1.3 Open console. Start configuring /opt/solr/etc/jetty-logging.xml:
nano /opt/solr/etc/jetty-logging.xml
Add this settings to this file:
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<!-- =============================================================== -->
<!-- Configure stderr and stdout to a Jetty rollover log file -->
<!-- this configuration file should be used in combination with -->
<!-- other configuration files. e.g. -->
<!-- java -jar start.jar etc/jetty-logging.xml etc/jetty.xml -->
<!-- =============================================================== -->
<Configure id="Server" class="org.mortbay.jetty.Server">
<New id="ServerLog" class="java.io.PrintStream">
<Arg>
<New class="org.mortbay.util.RolloverFileOutputStream">
<Arg><SystemProperty name="jetty.logs" default="."/>/yyyy_mm_dd.stderrout.log</Arg>
<Arg type="boolean">false</Arg>
<Arg type="int">90</Arg>
<Arg><Call class="java.util.TimeZone" name="getTimeZone"><Arg>GMT</Arg></Call></Arg>
<Get id="ServerLogName" name="datedFilename"/>
</New>
</Arg>
</New>
<Call class="org.mortbay.log.Log" name="info"><Arg>Redirecting stderr/stdout to <Ref id="ServerLogName"/></Arg></Call>
<Call class="java.lang.System" name="setErr"><Arg><Ref id="ServerLog"/></Arg></Call>
<Call class="java.lang.System" name="setOut"><Arg><Ref id="ServerLog"/></Arg></Call></Configure>
1. Installation of SOLR
1.4 Open console. Create user ‘solr’ and give him access:
sudo useradd -d /opt/solr -s /sbin/false solr
sudo chown solr:solr -R /opt/solr
1.5 Open console. Download script for starting jetty automatically on system
start:
sudo wget -O /etc/init.d/jetty
http://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk/jetty-
distribution/src/main/resources/bin/jetty.sh
sudo chmod a+x /etc/init.d/jetty
sudo update-rc.d jetty defaults
2. Preparing SOLR Core for Drupal
2.1 We need to create Solr core for our Drupal site, by default solr has one
core which is called ‘collection1’, so we can just create our core from this one:
cd /opt/solr/solr
mv collection1 drupal
cd drupal
And we need to rename core in file core.properties:
nano core.properties
2. Preparing SOLR Core for Drupal
2.2 Replace all files with settings in drupal solr core for those that are in a base
of a module Search API Solr.
So, we should download module https://www.drupal.org/project/search_api_solr.
And replace all files which are based in /opt/solr/solr/drupal/conf/ for files which are in search_api_solr/solr-
conf/4.x/
After this we should restart jetty:
sudo /etc/init.d/jetty restart
3. Preparing Drupal
3.1 Download modules which we need for our search which are based in
search API:
https://www.drupal.org/project/search_api
https://www.drupal.org/project/search_api_solr
https://www.drupal.org/project/facetapi
3.2 Enable next modules:
Search API, Search facets, Search views, Solr search
3. Preparing Drupal
3.3 Create new Search api server:
Go to /admin/config/search/search_api and click ‘Add server’. After filling ‘Server name’ and ‘Server description’ you
should choose ‘solr service’ in ‘Service class’ field. After this you should change only ‘Solr path’ field, to ‘/solr/drupal’,
and click ‘Create server’.
If all works fine you would see something like this:
3. Preparing Drupal
3.4 Create new Search api index:
Go to /admin/config/search/search_api and click ‘Add index’. After filling ‘Index name’ (in our case it will be nodes) and
‘Index description’ you should choose ‘node’ in ‘Item type’ field, and choose server in ‘Server’ field which you have
created, and click ‘Create Index’.
On this page you can choose fields which you want to show on search result:
3. Preparing Drupal
on tab ‘view’ of our index (in our case it’s ‘nodes’) we can reindex all content:
If we want to see immediately our NEW content in solr we should reindex content.
3. Preparing Drupal
3.5 Create new view with our Search index:
You should just choose your search index on view creation, and to work with it as with standart view:
4. Facets API
4.1 Create new Facet:
In your search index you can enable facet to each field which you have added to your search index. So we will enable
facet for content type field:
4. Facets API
4.2 Add Facet to view page:
So now you can add your Facet to page with search result view as a block which you can find on
admin/structure/block. In our case it’s something like this:
4. Facets API
4.3 Load facets in code:

Mais conteúdo relacionado

Mais procurados

Денис Лебедев-Управление зависимостями с помощью CocoaPods
Денис Лебедев-Управление зависимостями с помощью CocoaPodsДенис Лебедев-Управление зависимостями с помощью CocoaPods
Денис Лебедев-Управление зависимостями с помощью CocoaPods
UA Mobile
 
ISUCONアプリを Pythonで書いてみた
ISUCONアプリを Pythonで書いてみたISUCONアプリを Pythonで書いてみた
ISUCONアプリを Pythonで書いてみた
memememomo
 

Mais procurados (7)

Денис Лебедев-Управление зависимостями с помощью CocoaPods
Денис Лебедев-Управление зависимостями с помощью CocoaPodsДенис Лебедев-Управление зависимостями с помощью CocoaPods
Денис Лебедев-Управление зависимостями с помощью CocoaPods
 
ISUCONアプリを Pythonで書いてみた
ISUCONアプリを Pythonで書いてみたISUCONアプリを Pythonで書いてみた
ISUCONアプリを Pythonで書いてみた
 
Great Developers Steal
Great Developers StealGreat Developers Steal
Great Developers Steal
 
Building Cloud Castles - LRUG
Building Cloud Castles - LRUGBuilding Cloud Castles - LRUG
Building Cloud Castles - LRUG
 
Readme
ReadmeReadme
Readme
 
Hadoop Israel - HBase Browser in Hue
Hadoop Israel - HBase Browser in HueHadoop Israel - HBase Browser in Hue
Hadoop Israel - HBase Browser in Hue
 
Project 2 How to modify os161: A Manual
Project 2 How to modify os161: A ManualProject 2 How to modify os161: A Manual
Project 2 How to modify os161: A Manual
 

Semelhante a DRUPAL Search API Solr

php-and-zend-framework-getting-started
php-and-zend-framework-getting-startedphp-and-zend-framework-getting-started
php-and-zend-framework-getting-started
tutorialsruby
 
php-and-zend-framework-getting-started
php-and-zend-framework-getting-startedphp-and-zend-framework-getting-started
php-and-zend-framework-getting-started
tutorialsruby
 
php-and-zend-framework-getting-started
php-and-zend-framework-getting-startedphp-and-zend-framework-getting-started
php-and-zend-framework-getting-started
tutorialsruby
 
php-and-zend-framework-getting-started
php-and-zend-framework-getting-startedphp-and-zend-framework-getting-started
php-and-zend-framework-getting-started
tutorialsruby
 
Open Atrium (DrupalCon Paris 2009, Day 3)
Open Atrium (DrupalCon Paris 2009, Day 3)Open Atrium (DrupalCon Paris 2009, Day 3)
Open Atrium (DrupalCon Paris 2009, Day 3)
Cameron Eagans
 
Symfony2 Introduction Presentation
Symfony2 Introduction PresentationSymfony2 Introduction Presentation
Symfony2 Introduction Presentation
Nerd Tzanetopoulos
 

Semelhante a DRUPAL Search API Solr (20)

Rails and the Apache SOLR Search Engine
Rails and the Apache SOLR Search EngineRails and the Apache SOLR Search Engine
Rails and the Apache SOLR Search Engine
 
sfdx continuous Integration with Jenkins on aws (Part II)
sfdx continuous Integration with Jenkins on aws (Part II)sfdx continuous Integration with Jenkins on aws (Part II)
sfdx continuous Integration with Jenkins on aws (Part II)
 
Ios application bundle by flutter
Ios application bundle by flutterIos application bundle by flutter
Ios application bundle by flutter
 
I os application bundle by flutter
I os application bundle by flutterI os application bundle by flutter
I os application bundle by flutter
 
PHP
PHP PHP
PHP
 
php-and-zend-framework-getting-started
php-and-zend-framework-getting-startedphp-and-zend-framework-getting-started
php-and-zend-framework-getting-started
 
php-and-zend-framework-getting-started
php-and-zend-framework-getting-startedphp-and-zend-framework-getting-started
php-and-zend-framework-getting-started
 
php-and-zend-framework-getting-started
php-and-zend-framework-getting-startedphp-and-zend-framework-getting-started
php-and-zend-framework-getting-started
 
php-and-zend-framework-getting-started
php-and-zend-framework-getting-startedphp-and-zend-framework-getting-started
php-and-zend-framework-getting-started
 
Custom module and theme development in Drupal7
Custom module and theme development in Drupal7Custom module and theme development in Drupal7
Custom module and theme development in Drupal7
 
Test02
Test02Test02
Test02
 
Aosp+
Aosp+Aosp+
Aosp+
 
Appium- part 1
Appium- part 1Appium- part 1
Appium- part 1
 
Open Atrium (DrupalCon Paris 2009, Day 3)
Open Atrium (DrupalCon Paris 2009, Day 3)Open Atrium (DrupalCon Paris 2009, Day 3)
Open Atrium (DrupalCon Paris 2009, Day 3)
 
Advanced Search with Solr - User Guide
Advanced Search with Solr - User GuideAdvanced Search with Solr - User Guide
Advanced Search with Solr - User Guide
 
Uploading files using selenium web driver
Uploading files using selenium web driverUploading files using selenium web driver
Uploading files using selenium web driver
 
Symfony2 Introduction Presentation
Symfony2 Introduction PresentationSymfony2 Introduction Presentation
Symfony2 Introduction Presentation
 
DevOps Hackathon: Session 3 - Test Driven Infrastructure
DevOps Hackathon: Session 3 - Test Driven InfrastructureDevOps Hackathon: Session 3 - Test Driven Infrastructure
DevOps Hackathon: Session 3 - Test Driven Infrastructure
 
Fast Paced Drupal 8: Accelerating Development with Composer, Drupal Console a...
Fast Paced Drupal 8: Accelerating Development with Composer, Drupal Console a...Fast Paced Drupal 8: Accelerating Development with Composer, Drupal Console a...
Fast Paced Drupal 8: Accelerating Development with Composer, Drupal Console a...
 
Android Workshop: Day 1 Part 3
Android Workshop: Day 1 Part 3Android Workshop: Day 1 Part 3
Android Workshop: Day 1 Part 3
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

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
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
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?
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
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
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
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...
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
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
 
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
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 

DRUPAL Search API Solr

  • 1. SOLR + Search API Facets API
  • 2. 1. Installation of SOLR 1.1 Open console. Start install solr with jetty for web-server: sudo apt-get -y install openjdk-7-jdk cd /opt wget http://archive.apache.org/dist/lucene/solr/4.7.2/solr-4.7.2.tgz tar -xvf solr-4.7.2.tgz cp -R solr-4.7.2/example /opt/solr cd /opt/solr java -jar start.jar After this we can check if all works on http://YOUR_IP:8983/solr. After this we need to close app in console with Ctrl+C.
  • 3. 1. Installation of SOLR 1.2 Open console. Start configuring /etc/default/jetty: nano /etc/default/jetty Add this settings to this file: NO_START=0 JAVA_OPTIONS="-Dsolr.solr.home=/opt/solr/solr $JAVA_OPTIONS" JAVA_HOME=/usr/java/default JETTY_HOME=/opt/solr JETTY_USER=solr JETTY_LOGS=/opt/solr/logs Save file!
  • 4. 1. Installation of SOLR 1.3 Open console. Start configuring /opt/solr/etc/jetty-logging.xml: nano /opt/solr/etc/jetty-logging.xml Add this settings to this file: <?xml version="1.0"?> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd"> <!-- =============================================================== --> <!-- Configure stderr and stdout to a Jetty rollover log file --> <!-- this configuration file should be used in combination with --> <!-- other configuration files. e.g. --> <!-- java -jar start.jar etc/jetty-logging.xml etc/jetty.xml --> <!-- =============================================================== --> <Configure id="Server" class="org.mortbay.jetty.Server"> <New id="ServerLog" class="java.io.PrintStream"> <Arg> <New class="org.mortbay.util.RolloverFileOutputStream"> <Arg><SystemProperty name="jetty.logs" default="."/>/yyyy_mm_dd.stderrout.log</Arg> <Arg type="boolean">false</Arg> <Arg type="int">90</Arg> <Arg><Call class="java.util.TimeZone" name="getTimeZone"><Arg>GMT</Arg></Call></Arg> <Get id="ServerLogName" name="datedFilename"/> </New> </Arg> </New> <Call class="org.mortbay.log.Log" name="info"><Arg>Redirecting stderr/stdout to <Ref id="ServerLogName"/></Arg></Call> <Call class="java.lang.System" name="setErr"><Arg><Ref id="ServerLog"/></Arg></Call> <Call class="java.lang.System" name="setOut"><Arg><Ref id="ServerLog"/></Arg></Call></Configure>
  • 5. 1. Installation of SOLR 1.4 Open console. Create user ‘solr’ and give him access: sudo useradd -d /opt/solr -s /sbin/false solr sudo chown solr:solr -R /opt/solr 1.5 Open console. Download script for starting jetty automatically on system start: sudo wget -O /etc/init.d/jetty http://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk/jetty- distribution/src/main/resources/bin/jetty.sh sudo chmod a+x /etc/init.d/jetty sudo update-rc.d jetty defaults
  • 6. 2. Preparing SOLR Core for Drupal 2.1 We need to create Solr core for our Drupal site, by default solr has one core which is called ‘collection1’, so we can just create our core from this one: cd /opt/solr/solr mv collection1 drupal cd drupal And we need to rename core in file core.properties: nano core.properties
  • 7. 2. Preparing SOLR Core for Drupal 2.2 Replace all files with settings in drupal solr core for those that are in a base of a module Search API Solr. So, we should download module https://www.drupal.org/project/search_api_solr. And replace all files which are based in /opt/solr/solr/drupal/conf/ for files which are in search_api_solr/solr- conf/4.x/ After this we should restart jetty: sudo /etc/init.d/jetty restart
  • 8. 3. Preparing Drupal 3.1 Download modules which we need for our search which are based in search API: https://www.drupal.org/project/search_api https://www.drupal.org/project/search_api_solr https://www.drupal.org/project/facetapi 3.2 Enable next modules: Search API, Search facets, Search views, Solr search
  • 9. 3. Preparing Drupal 3.3 Create new Search api server: Go to /admin/config/search/search_api and click ‘Add server’. After filling ‘Server name’ and ‘Server description’ you should choose ‘solr service’ in ‘Service class’ field. After this you should change only ‘Solr path’ field, to ‘/solr/drupal’, and click ‘Create server’. If all works fine you would see something like this:
  • 10. 3. Preparing Drupal 3.4 Create new Search api index: Go to /admin/config/search/search_api and click ‘Add index’. After filling ‘Index name’ (in our case it will be nodes) and ‘Index description’ you should choose ‘node’ in ‘Item type’ field, and choose server in ‘Server’ field which you have created, and click ‘Create Index’. On this page you can choose fields which you want to show on search result:
  • 11. 3. Preparing Drupal on tab ‘view’ of our index (in our case it’s ‘nodes’) we can reindex all content: If we want to see immediately our NEW content in solr we should reindex content.
  • 12. 3. Preparing Drupal 3.5 Create new view with our Search index: You should just choose your search index on view creation, and to work with it as with standart view:
  • 13. 4. Facets API 4.1 Create new Facet: In your search index you can enable facet to each field which you have added to your search index. So we will enable facet for content type field:
  • 14. 4. Facets API 4.2 Add Facet to view page: So now you can add your Facet to page with search result view as a block which you can find on admin/structure/block. In our case it’s something like this:
  • 15. 4. Facets API 4.3 Load facets in code: