Git Product home page Git Product logo

solr-for-wordpress's Introduction

=== Solr for WordPress ===
Contributors: mattweber
Author URI: http://www.mattweber.org
Plugin URI: https://github.com/mattweber/solr-for-wordpress
Donate link: http://www.mattweber.org
Tags: solr, search, search results, search integration, custom search 
Requires at least: 3.0
Tested up to: 3.2.1
Stable tag: 0.5.1

A WordPress plugin that replaces the default WordPress search with Solr.

== Description ==

A WordPress plugin that replaces the default WordPress search with Solr.  Features include:

*	Index pages and posts
*	Enable faceting on fields such as tags, categories, author, and page type.
* Indexing and faceting on custom fields
* Multisite support
*	Treat the category facet as a taxonomy
*	Add special template tags so you can create your own custom result pages to match your theme.
* Completely replaces default WordPress search, just install and configure.
* Completely integrated into default WordPress theme and search widget.
*	Configuration options allow you to select pages to ignore, features to enable/disable, and what type of result information you want output.
* i18n Support
* Multi server/core support

    Note that this plugin requires you to have an instance of Solr using a schema with the following fields: id, permalink, title, content, numcomments, categories, categoriessrch, tags, tagssrch, author, type, and text.  The facet fields (categories, tags, author, and type) should be string fields.  You can make tagssrch and categoriessrch of any type you want as they are used for general searching.  The plugin is distributed with a Solr schema you can use at `solr-for-wordpress/schema.xml`.


== Installation ==

1. Upload the `solr-for-wordpress` folder to the `/wp-content/plugins/` directory
2. Activate the plugin through the 'Plugins' menu in WordPress
3. Configure the plugin with the hostname, port, and URI path to your Solr installation.
4. Load all your posts and/or pages via the "Load All Posts" button in the settings page.

= Custom Theme Integration =
1. Create a new theme file called "s4w_search.php".
2. Insert your markup, use template methods s4w_search_form() and s4w_search_results() to insert the search box and results respectively.
3. Add result styling to your theme css file, see `solr-for-wordpress/template/search.css` for an example.
4. You can use the search widget in your sidebar for search, or use a custom search box that submits the query in the parameter "s".


== Frequently Asked Questions ==

= What version of WordPress does Solr for WordPress work with? =

Solr for WordPress works with WordPress 3.0 and greater.

= What version of Solr is required. =

Solr 1.4 or greater.

= Can I enable/disable specific facets. =

Yes, from the settings page.  Uncheck the "Facet on FIELD" option, for the FIELD you don't want a facet for.

= Do I need to run my own Solr server to use this plugin? =

No, there are Solr hosting providers that will setup and manager Solr for you.  As long as they allow custom schema's and support the 
standard Solr http api, then the plugin should work.  Some sites:

http://www.mysolrserver.com/
http://www.websolr.com/
http://powcloud.com/

= Can I run a local instance of Solr for testing? =

Yes, you may grab a copy from the apache website: http://www.apache.org/dist/lucene/solr/
Since it runs on java solr is platform independent, just make sure you have java install So go ahead and Download the .tgz/.zip file (there is no difference).
1) Extract the files you have downloaded
2) Copy the schema file (schema.xml) from this plugin to the folder you extracted 'apache-solr-*/examples/solr/conf/' (yes overwrite the file there)
3) Open up terminal and then go to where you extracted the files and inside './apache-solr-*/examples' run the command "java -jar start.jar"

For any further information please the README that comes with solr.

= What is a taxonomy =

A taxonomy is a hierarchal facet.  This means that your subcategories will be treated as a child to the parent category instead of an individual facet.  

Here is what an example category taxonomy look like:

`
-States
---California
------Los Angeles
---New York
------New York
`

Here is that same category not treating it as a taxonomy:

`
-States
-California
-Los Angeles
-New York
-New York
`

As you can see, treating it as a taxonomy is much better.

= I was treating the category as a taxonomy disabled it, now my category facet looks weird =

You need to delete and re-index your data.  

= How do I know what html tags to style in my custom theme =

See `solr-for-wordpress/template/search.css` for an example, or view the source of the search results.

= Can I create a custom search page such as http://www.myblog.com/search/? =

Yes, it is fairly trivial as well.  Follow the steps for custom theme integration.  At the top of that page, insert a comment similar to the following:

<?php
/*
Template Name: Search
*/
?>

Login to the WordPress admin GUI, select add new page, set the title of the page to "Search".  On the right hand side you will see a drop-down box that says "Template", click that and select "Search".  Leave the content of the page blank and publish the page.  

You will have have your "/search/" page.

= I need the output of this plugin in a different language =

Solr for WordPress is internationalized.  There is supplied .pot file that you can use for translations.  See http://codex.wordpress.org/Translating_WordPress for more details.

= How do I find out the page or post id to exclude? =

Login to the WordPress admin, select pages, click the page you want to exclude.  The post id is what you are looking for, you can find it in the titlebar as the &post= parameter.  In this example, the page id is 22, http://www.yourblog.com/wp-admin/page.php?action=edit&post=22.


== Screenshots ==

1. Configuration Page
2. Example of results page in default WordPress Theme

== Credits ==

Dominique Bejean for custom field support and testing.
Eric Pugh multi server support.
Dustin Rue - fixes for batch import and multisite.

solr-for-wordpress's People

Contributors

bejean avatar davidgoodwin avatar dustinrue avatar kwadronaut avatar mattweber avatar nullvariable avatar shaksi avatar spiroid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

solr-for-wordpress's Issues

Duplicate Results

So, after fixing the FF issue and using Chrome I was checking the index. If I do a "Load all Posts" and "Load all Pages" everything works correctly. However, if I then go back and "Update" one of the posts, then it adds a duplicate entry into the index and will give me 2 search results.

If I go back in and update a 2nd time on the same post I'm not getting a 3rd instance of the post in the results index though. If it picks up the Create Post then it's not adding another one on the Update Post. I'm guessing there is some sort of check that is missing in the "Load all Posts/Pages"

Thanks,

WordPress Multisite

Is there any particular reason why you haven't worked to convert this to MultiSite? Or for that matter to being used in the newer versions of WordPress? It doesn't seem all that difficult to just change the is_wpmu() to is_multisite()? Am I missing something bigger here?

I'm not sure I want to just index "my" content and since that part seemed to be the hardest part of doing a multisite search I had also already looked into using Nutch to crawl and index everything. If that's the case and the Index already exists where could I just use the Search Form portion of this plugin to display the Search results from Solr?

I'm running CentOS on the box I set up for this and my libxml2 is a like 2 versions back from what php.net suggests as the minimum is the whole thing going to crash if I try to do the work on this to update it?

And I'm new to github and colaborative development completely so I'm not sure how to even start this here or do I just do it all myself? I'd love to include it as part of the project here as a decent Search functionality is Seriously lacking in WordPress Multisite.

Thanks,

Jerry Craig
Cupbearer

Unable to index user defined XML

I have an XML file which I have indexed using my PHP code and Solr. I have indexed based on the tags in the xml file. However, now i want to do that using wordpress. I was trying to do the same using solr-for-wordpress but havent reached any solution for that. Is it possible to do that using this plugin ?

Problems with current sources

The plugins doesn't work anymore.
I had to comment 2 lines in solr-options-page.php file

foreach( $options as $key => $value ) {
if( $existing = get_option($key)) {
//krumo( $existing);
$options[$key] = $existing;
delete_option($key);
$indexall = FALSE;
//$option_function($key);
}
}

Furthermore, it looks like settings are sometimes reset to default (I am investigating)

Wildcard Searches

Is there a way to do wildcard searches with the plugin on the page? I'm actually looking to just add this as the home page with a search of "All" so that I can use the filtering and faceting that is built into SOLR. On my Linux box I just do a : in the search for everything, but that doesn't work with the plugin.

Thanks,

Jerry

Release 0.5.0 to Wordpress Plugin Site

Everyone, thanks for all the work you have been doing on the plugin. WIth all these changes I think it would be a good time to push out a 0.5.0 version to the Wordpress Plugin site. Please test the latest version of the master branch and let me know if you have any issues. If not I will push out a 0.5.0 version in the next week or so.

Thanks,
Matt Weber

Thoughts on seperating wp config and solr logic

I feel as the plugin matures the code base will grow quite quickly as it has done so in the past few months, making it hard to read through.

What are your thoughts on separating the wp configuration (or anything to do with it) into a different include file?

Solr options page not being loaded

Hi,
I installed the plugin following your directions. I had a couple deprecation warnings that I fixed related to is_super_admin() and using roles and capabilities instead of levels, but I'm still not seeing any solr for wordpress settings page.

Im still getting an error from when s4w_options_init() is called:
Notice: Undefined index: method in /Library/WebServer/Documents/complex/wordpress/wp-content/plugins/solr-for-wordpress/solr-for-wordpress.php on line 933 Method is:

It appears s4w_add_pages() is never being called, which I see is what adds the options page that I need to get to.

I am using wordpress 3.2.1.
Any idea what is going on?
Thanks,
Dan

Add support for WordPress 3.0 User Levels

When installing the solr-for-wordpress debug mode is showing

'has_cap was called with an argument that is deprecated since version 2.0! Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead.'

On curtain WP install this affect the possibility to save solr-for-wordpress configuration, ending up with 'You do not have sufficient permissions to access this page' message.

Article on how to fix this - http://tumbledesign.com/fix-notice-has_cap-was-called-with-an-argument-that-is-deprecated-since-version-2-0-in-wordpress/

Wordpress documentation on User Levels - http://codex.wordpress.org/User_Levels

autocomplete errors out on clean install

search still works but the autocomplete shows error.
This is with a vanilla install of WP 3.2.1

[Sun Aug 28 19:10:45 2011] [error] [client 127.0.0.1] PHP Fatal error: Uncaught exception 'Exception' with message '"404" Status: Not Found' in /Users/shaksi/Sites/wordpress/wp-content/plugins/solr-for-wordpress/Apache/Solr/Service.php:294\nStack trace:\n#0 /Users/shaksi/Sites/wordpress/wp-content/plugins/solr-for-wordpress/Apache/Solr/Service.php(934): Apache_Solr_Service->_sendRawGet('http://localhos...')\n#1 /Users/shaksi/Sites/wordpress/wp-content/plugins/solr-for-wordpress/solr-for-wordpress.php(1281): Apache_Solr_Service->search('post', 0, NULL, Array)\n#2 /Users/shaksi/Sites/wordpress/wp-content/plugins/solr-for-wordpress/solr-for-wordpress.php(1149): s4w_autocomplete('post', NULL)\n#3 [internal function]: s4w_template_redirect('')\n#4 /Users/shaksi/Sites/wordpress/wp-includes/plugin.php(405): call_user_func_array('s4w_template_re...', Array)\n#5 /Users/shaksi/Sites/wordpress/wp-includes/template-loader.php(7): do_action('template_redire...')\n#6 /Users/shaksi/Sites/wordpress/wp-blog-header.php(16): require_once('/Users/shaksi/S...')\n#7 /Users/shaksi/Sites/wordpress/index.php(17) in /Users/shaksi/Sites/wordpress/wp-content/plugins/solr-for-wordpress/Apache/Solr/Service.php on line 294, referer: http://wp.local/?s=post

Solr 3.5 + WP 3.3 - issue with schema. Core doesn't show up

Hi - I found the following issue and will appreciate it if you can fix it

Environment: Centos 5.x 64 bit, server= jetty, solr: 3.5 multicore, Wordpress 3.3

Initial setup

  1. Install WP and solrforwordpress plugin
  2. install Solr with Jetty as multicore and start it
  3. go to localhost:8083 and you will core0 and core1 as options on the admin

Test Schema
4) Copy schema.xml from solrforwordpress plugin into core0/conf
5) restart solr
6) go to local host:8083 and you will not see core0 anymore
NOTE: same thing happens when I get the schema.xml from git

Test plugin
7)ignore the issue with core0 and enter its details in the plugin and Check Server comes back as Ping failed
8) use core1 instead of core0 (note core1 has default schema.xml and shows up in solr admin) . Same result of Ping failed

Thank you for this plugin and let me know if you have any questions on the setup

Fuji

Synonyms filter

I'm doing my best to explore the functionality of this plugin and I would be interested in expanding the online documentation resources surrounding this plugin.

First, does this plugin support the use of synonyms.txt ? There are two analyzers that feature the SynonymFilterFactory in the schema.xml of the plugin directory.

A Query analyzer uses the WhitespaceTokenizerFactory and filters the synonyms.txt as featured on line 40, but it does not seem to do the job when I go and run a search.

I'm not sure what the second use of the SynonymFilterFactory is used for (see line 51).

Any help is greatly appreciated. Thanks!

Ping Failed! error

I am creating separate issue for ping failed instead of reusing #30

Environment: Centos 5.x 64 bit, server= jetty, Wordpress 3.3

When doing Check Server Settings I get ping failed.

  1. Solr 3.5: Multicore - added PingRequestHandler to solrconfig.xml. Still had ping failed issue
  2. Solr 3.5: single core - PingFailed
  3. Solr 1.4: Single Core - Ping Failed

Note: in all these cases I was able to use Solr's admin in the browser to get successful pings. Only failed through wordpress. I think its due to this but I get "Sorry, search is unavailable right now" when I try searching

Thanks,
Fuji

Remove duplicate utf8 encoding

Calling utf8_encode in SolrPhpClient/Apache/Solr/Service.php on line 770 destroys multibyte characters.

Suggested change: (might also be good to add before calling htmlspecialchars on line 787 in the same file )

if( !seems_utf8($multivalue) )
  $multivalue = utf8_encode($multivalue);

word1 word2 in a post become word1word2 in the index

If the post contains something like

word1</h4>

<p>word2

strip_tags($post_info->post_content) converts this in

word1\r\n\r\n\r\nword2

then in Service.php, $rawPost .= $this->_documentToXmlFragment($document); converts this in

word1word2

due to the line

$value = preg_replace('/\pC/u', '', $value); // remove unicode Control chars.

so searching word1 do not return the document and the speelcheking suggests "word1word2"

the issue is in solr-php-client, but it should be workarounded in s4w_build_document with

$doc->setField( 'content', preg_replace('/\r\n/', ' ', strip_tags($post_info->post_content)) );

Problems with Schema.xml on local instance of Solr

Hello! My goal is to get this plugin working with a local instance of solr.

I have a local instance of Solr. I am using Ubuntu/OpenJDK. I'm able to get to the admin screens of both solr and the solr-for-wordpress plugin.

My config settings in wordpress are:
host: localhost
port: 8983
path: /solr

However, when I copy the schema.xml provided by the plugin into the folder: /solr/example/solr/collection1/conf, I'm seeing this:

SEVERE: Unable to create core: collection1
org.apache.solr.common.SolrException: Plugin init failure for [schema.xml] fieldType "text": Plugin init failure for [schema.xml] analyzer/filter: Error loading class 'solr.EnglishPorterFilterFactory'

Multiple Post Types

Is it possible to create some sort of an Array for Post Types to check the database for? I know there is a way to do it, but am I the only one that seems interested in this? I'm working on my own stuff with the plugin, and I'm continually struggling with github to get it to work correctly.

Thanks,

Tika integration

I'm looking for any documentation on how to integrate Apache Tika with the Solr for WordPress plugin. Would be great to index .PDF content and link to the corresponding post/page.

Unable to configure a single server

Configuring a single Solr server doesn't work and it seems it is because the option fields for the master/slave setup clobber the single server options. If I configure the master/slave fields then my single server fields will update, but not the other way around

Support for custom post type

WP installs are getting a more complex nature, and support for custom post type would be a great addition to this plugin.

Sort By: Results

The Drop Down for the "Sort by:" Relevance - Newest - Oldest - Most Comments - Least Comments isn't dropping down for me? Is there some sort of a Java Library I need to be loading on the page that I'm not or something like that? It doesn't look like the suckerfish css dropdown to me, so I'm not sure how it's supposed to be set up to work. Since so much of this is based on java I thought maybe there was something I was missing.

Thanks,

Indexing posts or pages with Firefox 6.x doesn't work

With FF 6.x, It looks like the handleResults callback function is not properly called after

$j.post("options-general.php?page=solr-for-wordpress/solr-for-wordpress.php", {method: "load", type: $type}, handleResults, "json");

So only the 100 first posts are sent to Solr but never commited.

It doesn't occured 100% but main of the time.
It works when I call $j.post in debug mode with Firebug.

Other people reported this issue.
http://bugs.jquery.com/ticket/10071

Unable to configure in WP 3.3.1

Hi!

I installed a fresh version of WP, version 3.3.1, and then installed the latest Solr for Wordpress plug-in but when I try to save the settings I get a "You do not have sufficient permissions to access this page." error. I use the "Single Server" mode. I first ran into this problem trying to install it on my Debian VPS but I get exactly the same error using my WAMP/Bitnami stack...

Any ideas of what's wrong here?

Many thanks!
Peter

In solr option page remove solr version reference

The plugin works fine with Solr 3.x, so the following string
"Download, install and configure your own Apache Solr 1.4 instance"

should be changed into

"Download, install and configure your own Apache Solr instance"

Search post title?

In the Wiki, you can specify the fields that you are searching for via this syntax:

q=superman&qf=title subject

But this doesn't seem to work in the Solr plugin. Also, the q parameter is replaced with an s in WordPress

Hierarchical custom taxonomy

I've successfully index my custom taxonomy terms but they are not hierarchical like the categories field. I'm working on a fix but if anyone has a solution, let me know.

Solr-for-wordpress not detected in wordpress admin -> plugins

I installed a local version of solr. The server is currently running.
I installed wordpress 3.4.2 (latest) and downloaded and extracted solr-for-wordpress into the www/wordpress/wp-content/solr-for-wordpress directory

However, when I access wp-admin, I am unable to see solr-for-wordpress listed. I am able to see akismet, but not solr. I verified my permissions are correct and www-data is the owner of all the files.

Anyone else experience this?

solr moduel not working properly

I'm not sure if I can get some help here but I'll try :)

A colleague and I were trying for a week to get solr for wordpress working on our linux (ubuntu) server though without any success.
By some reason the module wouldn't initiate communication with external server (seems no socket was ever tried to be open).
The firewall is not noticing any communication and even tcpdump doesn't catch any traffic.
Apache/php/syslog logs are not making us any smarter (no clue about what could be wrong).
We are using chroot environment for the users and external AD authentication (through Identity Management for UNIX role)with user owner of the folder and www-data as group owner.
Wordpress is working fine, solr module is installed and seems like it is working though ping failed is reported.
Does anybody have any suggestion what could cause this problem or give me any idea what we could check.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.