PHP code example of pantheon-systems / solr-power

1. Go to this page and download the library: Download pantheon-systems/solr-power library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

pantheon-systems / solr-power example snippets


add_filter( 'is_solr_query', function( $enabled, $query ) {
    if ( $query->is_category( 'news' ) ) {
        return false;
    }
    return $enabled;
}, 10, 2 );

define( 'SOLRPOWER_DISABLE_AUTOCOMMIT', false );
examples/example.custom_WP_Query.php

<copyField source="post_author" dest="text"/>
 php
add_filter('solr_power_customer_schema_file_path', function($custom_schema_file_path) {
    return '/absolute/path/to/schema.xml';
});