Search is critical for your site, but the default search for WordPress leaves a lot to be desired. Improve your user experience with the Apache Solr search engine for your WordPress website.
This plugin is under active development on GitHub:
https://github.com/pantheon-systems/solr-power
Please feel free to file issues there. Pull requests are also welcome! See CONTRIBUTING.md for information on contributing.
For further documentation, such as available filters and working with the SolrPower_Api class directly, please see the project wiki:
https://github.com/pantheon-systems/solr-power/wiki
You may notice there are two sets of tests running, on two different services:
Both of these test suites can be run locally, with a varying amount of setup.
PHPUnit requires the WordPress PHPUnit test suite, and access to a database with name wordpress_test. If you haven’t already configured the test suite locally, you can run bash bin/install-wp-tests.sh wordpress_test root '' localhost. You’ll also need access to a running Solr instance, in order to run the unit tests against Solr.
Behat requires a Pantheon site with Solr enabled. Once you’ve created the site, you’ll need install Terminus, and set the TERMINUS_TOKEN, TERMINUS_SITE, and TERMINUS_ENV environment variables. Then, you can run ./bin/behat-prepare.sh to prepare the site for the test suite.
Note that dependencies are installed via Composer and the vendor directory is not committed to the repository. You will need to run composer install locally for the plugin to function. You can read more about Composer here
This plugin has WP-CLI support.
All Solr Power related commands are grouped into the wp solr command, see an example:
$ wp solr usage: wp solr check-server-settings or: wp solr delete [<id>...] [--all] or: wp solr index [--batch=<batch>] [--batch_size=<size>] [--post_type=<post-type>] or: wp solr info [--field=<field>] [--format=<format>] or: wp solr optimize-index or: wp solr repost-schema or: wp solr stats [--field=<field>] [--format=<format>] See 'wp help solr <command>' for more information on a specific command.
You can see more details about the commands using wp help solr:
**NAME** wp solr **DESCRIPTION** Perform a variety of actions against your Solr instance. **SYNOPSIS** wp solr <command> **SUBCOMMANDS** check-server-settings Check server settings. delete Remove one or more posts from the index. index Index all posts for a site. info Report information about Solr Power configuration. optimize-index Optimize the Solr index. repost-schema Repost schema.xml to Solr. stats Report stats about indexed content.<h3>WP_Query Integration</h3>
Use Solr in a custom WP_Query instead of querying a database. Add 'solr_integrate' => true to the query arguments.
NOTE: Currently, only basic queries, tax_query, meta_query and date_query are supported. See examples/example.custom_WP_Query.php for an example.
A meta_query can use the following compare operators:
('REGEXP', 'NOT REGEXP', and 'RLIKE' are not supported.)
To support searching by author name (e.g. where “Pantheon” would return posts authored by the “Pantheon” user), add the following to your custom schema.xml:
<copyField source="post_author" dest="text"/>
The following guidance can be used to extend the Solr index and modify boosts beyond just this example.
To support math functions on dates, you must add a custom schema.xml to Solr and reindex with the new schema.
Add the following to schema.xml:
<!-- Add to <types> --> <!-- See: https://lucene.apache.org/solr/6_2_0/solr-core/org/apache/solr/schema/TrieDateField.html --> <fieldType name="tdate" class="solr.TrieDateField" omitNorms="true" precisionStep="6" positionIncrementGap="0"/> <!-- Add to <fields> --> <field name="post_date_iso" type="tdate" indexed="true" stored="true" required="true" />
Add the following to your functions.php file.
<?php /** * Hooks into the document build process to add post date field in proper format. */ function my_solr_build_document( $doc, $post_info ) { $post_time = strtotime( $post_info->post_date ); // Matches format required for TrieDateField $doc->setField( 'post_date_iso', gmdate( 'c\Z', $post_time ) ); return $doc; } add_filter( 'solr_build_document', 'my_solr_build_document', 10, 2 ); /** * Hooks into query processor, Dismax, to add publish date boost. * See: https://www.metaltoad.com/blog/date-boosting-solr-drupal-search-results */ function my_solr_dismax_query( $dismax ) { $dismax->setQueryParser( 'edismax' ); $dismax->setBoostQuery( 'recip(abs(ms(NOW/HOUR,post_date_iso),3.16e-11,1,1))' ); return $dismax; } add_filter( 'solr_dismax_query', 'my_solr_dismax_query' );
Once solr has sent the data to the solr server, solr must COMMIT the data to the index and adjust the index and relevancy ratings accordingly before that data can appear in search results.
By default, Solr Search for WordPress has auto-commit disabled. The index is committed when the uncommitted item is two minutes old, or the cron runs. By default, the cron runs on the Pantheon platform every hour.
When autocommit is enabled, Solr Search for WordPress commits data when it sends every post. When running on Pantheon, we recommend leaving autocommit disabled to aid overall site performance.
To enable autocommit, add the following to wp-config.php or an mu-plugin.
define( 'SOLRPOWER_DISABLE_AUTOCOMMIT', false );
To force-commit data outside of a normal cron run, from the command line, you can run the command below or simply force a cron-run.
wp solr commit
Starting from $0 per month.
Rating
Reviewers
2 reviews
Tags
Developed By
Pantheon Systems
Quick & Easy
Common Ninja has a large selection of powerful Wordpress plugins that are easy to use, fully customizable, mobile-friendly and rich with features — so be sure to check them out!
Testimonial plugins for Wordpress
Contact Form plugins for Wordpress
Maps plugins for Wordpress
Translation plugins for Wordpress
Chat plugins for Wordpress
Slider plugins for Wordpress
Reviews plugins for Wordpress
Contact plugins for Wordpress
Galleries plugins for Wordpress
SEO plugins for Wordpress
Forms plugins for Wordpress
Comments plugins for Wordpress
Backup plugins for Wordpress
Privacy plugins for Wordpress
Optimize plugins for Wordpress
Tabs plugins for Wordpress
Social Sharing plugins for Wordpress
Events Calendar plugins for Wordpress
Comments plugins for Wordpress
Social Feeds plugins for Wordpress
Social Sharing plugins for Wordpress
Portfolio plugins for Wordpress
Video Player plugins for Wordpress
popup plugins for Wordpress
SiteMap plugins for Wordpress
Payment plugins for Wordpress
Coming Soon plugins for Wordpress
Inventory plugins for Wordpress
Testimonials plugins for Wordpress
Portfolio plugins for Wordpress
Membership plugins for Wordpress
Forms plugins for Wordpress
Analytics plugins for Wordpress
Events Calendar plugins for Wordpress
Sliders plugins for Wordpress
Analytics plugins for Wordpress
Reviews plugins for Wordpress
Security plugins for Wordpress
Ads plugins for Wordpress
Music Player plugins for Wordpress
Countdown plugins for Wordpress
Email Marketing plugins for Wordpress
Membership plugins for Wordpress
Ecommerce plugins for Wordpress
Customer Support plugins for Wordpress
Video Player plugins for Wordpress
Tabs plugins for Wordpress
Social Feeds plugins for Wordpress
Common Ninja Apps
Browse our extensive collection of compatible plugins, and easily embed them on any website, blog, online store, e-commerce platform, or site builder.
Present Information in an Organized, Visually Appealing Manner
Keep Clients Informed & Boost Conversions With the Updates & Announcements Widget
Track scrolling with a customizable progress bar or indicator
Captivate Users With Interactive Before & After Images
Display fresh Reddit content effortlessly with customizable feeds.
Raise Awareness, Simplify Donations, and Make a Difference
Create Impressive Vimeo Feeds & Improve User Experience
Draw Attention, Collect Leads & Increase Conversions
Add Testimonials To Improve Credibility & Conversions
Boost Confidence & Enhance Reliability for Higher Sales
Engage, Alert, and Convert with Innovative Notifications
Create Beautiful Linkedin Feeds & Improve User Experience
More plugins
The Common Ninja Search Engine platform helps website builders find the best site widgets, apps, plugins, tools, add-ons, and extensions! Compatible with all major website building platforms - big or small - and updated regularly, our Search Engine tool provides you with the business tools your site needs!