Relevant info (note to self for writing a readme):

URL: http://svn.apache.org/repos/asf/lucene/solr/trunk/src/java/org/apache/so...
Repository Root: http://svn.apache.org/repos/asf
Repository UUID: 13f79535-47bb-0310-9956-ffa450edef68
Revision: 903517
Node Kind: file
Last Changed Author: hossman
Last Changed Rev: 901342

Index: apachesolr/src/java/org/apache/solr/search/QParserPlugin.java
===================================================================
--- apachesolr/src/java/org/apache/solr/search/QParserPlugin.java	(revision 10823)
+++ apachesolr/src/java/org/apache/solr/search/QParserPlugin.java	(working copy)
@@ -32,6 +32,7 @@
     PrefixQParserPlugin.NAME, PrefixQParserPlugin.class,
     BoostQParserPlugin.NAME, BoostQParserPlugin.class,
     DisMaxQParserPlugin.NAME, DisMaxQParserPlugin.class,
+    ExtendedDismaxQParserPlugin.NAME, ExtendedDismaxQParserPlugin.class,
     FieldQParserPlugin.NAME, FieldQParserPlugin.class,
     RawQParserPlugin.NAME, RawQParserPlugin.class,
     NestedQParserPlugin.NAME, NestedQParserPlugin.class,
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pwolanin’s picture

FileSize
2.4 KB
pwolanin’s picture

FileSize
2.08 KB

more compact

jpmckinney’s picture

Status: Active » Needs review
pwolanin’s picture

Status: Needs review » Needs work

need to add instructions to the README iwth details on building/patching Solr, and also add a config option to the module.

pwolanin’s picture

The repo has been reorganized for lucene/solr the code is now at:

http://svn.apache.org/repos/asf/lucene/dev/trunk/solr/src/java/org/apach...

see above rev.

ygerasimov’s picture

Edismax works nicely on solr 1.5 with adding requestHandler as per patch.

Are you going to patch QParserPlugin.java and build the same on solr 1.4? And for this you need to create documentation?

What kind of config option you think is needed in this case?

pwolanin’s picture

The patch above in #2 shows the configuration needed in solrconfig - you might want to make it the default handler.

I have already exported this .java file plus patched as shown above in the text at top and built Solr with this. It works pretty well.

ygerasimov’s picture

Maybe it can be nice idea to let user select any available handler?

I believe it is possible to parse XML document returned by http://localhost:8983/_solr_path_/admin/registry.jsp and get all options of QUERYHANDLERs. But really not sure whether it is reasonable for user to check anything except standard, dismax, edismax.

Please let me know your comments.

pwolanin’s picture

The user should not need to know anything about it in most cases - the admin should decide.

ygerasimov’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev
Status: Needs work » Needs review
FileSize
3.56 KB

I have added options in Advanced settings for choosing type of handler. Please review.

pwolanin’s picture

Status: Needs review » Needs work

no, I think that's really the wrong approach - and the names you list dont' even match what's in the solrconfig.

and we should never do this:

define('APACHESOLR_HANDLERS', serialize(array('edismax', 'dismax', 'standard')));
ygerasimov’s picture

Status: Needs work » Needs review
FileSize
4.43 KB

Yes. I haven't thought about solrconfig. Please review attached patch. Now I parse both solrconfig and response from Solr to get the list of available handlers. Will this do the job?

pwolanin’s picture

Status: Needs review » Needs work

seems like overkill - and 'dismax' is not the name of the handler we use by default at the moment.

I really feel like this is a rare enough use case that building a UI is overkill. How many people are going to build and deploy a custom Solr.war?

Lot of assumptions break if you switch to the standard handler, to the point where I don't think that is a good option.

ygerasimov’s picture

Status: Needs work » Fixed

One of the solutions for #270412: Partial-word search completion is just to switch to edismax handler or standard. That is why I thought it can be nice idea to let admin decide how he would like to behave. But if you think it is too much to give admin this opportunity and let him write the module that adds qt parameter in hook_apachesolr_modify_query, it is great.

pwolanin’s picture

Status: Fixed » Needs work

I think it might be useful to add a variable to define the default handler - that way you chould change it with a variable_set() instead of needing a hook implementation.

I would like to add info about edismax to the README or some other documentation.

ygerasimov’s picture

@pwolanin Could you please guide how to add needed files to solr in order to compile it with edismax support? Here is patch with some basic description, but the part with adding files is missing in README.txt.

pwolanin’s picture

Looking at the development log, one might want to try a rev or a few later than what I used, but to start, add this command before the patching command (remove the space after http which I added to skip the URL parser):

svn export -r901342  http ://svn.apache.org/repos/asf/lucene/dev/trunk/solr/src/java/org/apache/solr/search/ExtendedDismaxQParserPlugin.java src/java/org/apache/solr/search/ExtendedDismaxQParserPlugin.java

Also, I'd change this part of the patch:

+    'qt' => variable_get('apachesolr_search_handler', 'dismax'),

we do NOT want 'dismax' as the default - we want to use the solrconfig.xml default. Something more like:

+    $qt = variable_get('apachesolr_search_handler', NULL);
+    if (!empty($qt)) {
+      $params['qt'] = $qt;
+    }
ygerasimov’s picture

Status: Needs work » Needs review
FileSize
5.45 KB

Thanks for fast response. I hope I put everything clear in README.txt. Please review.

pwolanin’s picture

Looking at what Matt Butcher did for his Solr query library, it's worth looking at whether we can just set the defType=edismax rather than having to define a new named handler. That way would would not have to patch the solrconfig at all.

Nick_vh’s picture

Any update on this yet?

Since we really need to update to the edismax handler because we'd like to search in seperate fields and this is only available in the standard handler and not in the dismax we'd like to take benefit of the edismax.

However, patching is still not something I prefer to do, certainly not when the maintainers are a bit hold back because there might be a better way? By setting the qt=edismax an undefined handler pops up.

Could you give some more info about the Matt Butcher sources? Or how to proceed?

Nick_vh’s picture

Just to comment : I tried out the patch and everything seemed to work fine! :-)
Thanks for all the effort

pwolanin’s picture

see comment about defType in #19

scotjam’s picture

Can anyone point me to examples of sites using edismax?

I'd love to see how it improves the search experience, but a bit daunted about patching and rebuilding solr to try it out.

pwolanin’s picture

We have it on all sites using Acquia Search. For example: "http://www.drupalgardens.com/search/apachesolr_search/app*" rel="nofollow">http://www.drupalgardens.com/search/apachesolr_search/app*

jpmckinney’s picture

Component: Code » solrconfig.xml
pwolanin’s picture

seems like setting defType works - that would be preferred

jpmckinney’s picture

Status: Needs review » Active

What's the suggestion? To add a config var in the admin, that when set causes defType=edismax to be added as a Solr parameter in all requests? Or to have users set defType=edismax in a hook_apachesolr_modify_query, in which case this issue should be a support request.

pwolanin’s picture

@jpmckinney - the suggestion is to maybe to make it an opaque setting (not in the UI) for 6.x.

The nice thing about using defType instead of qt is that one does not need to alter the solrconfig.xml

pwolanin’s picture

Version: 6.x-2.x-dev » 7.x-1.x-dev
Category: task » feature
jpmckinney’s picture

pwolanin’s picture

Note for 7.x (and 6.x-3.x when it's opened) I think we'll want this as a per-server setting.

trothwell’s picture

Whats happening here? I'd like to see some partial word searching happening, any suggestions? Should i roll the patch?

pwolanin’s picture

@Funke-Tom. Well, depends what you are using on the server side whether it will work at all. What Solr version are you running?

You're welcome to roll the patch - it's relatively trivial, though note comments about 7.x being per search environment.

trothwell’s picture

@pwolanian, I'm running 6.x-1.5.

frognation’s picture

The patch from #18 works well on my local copy on my Mac! However, I'm having trouble with it on Ubuntu 9.10 on my live server. I was wondering if anyone can see something wrong I'm doing here:

I patched the files and rebuilt Solr according to the updated README, then I followed the instructions on this page http://www.nickveenhof.be/blog/setup-drupal-6-apache-solr-tomcat6-and-ub.... However, I'm getting an error only on my live server "HTTP Status 400 - unknown handler: edismax" (it says that it can't find the Apache Solr server in the UI, although the settings says it can see it fine)

Appreciate any help on this!

pwolanin’s picture

@Funke-Tom - What version of Solr are you running?

trothwell’s picture

@pwolanin - Sorry i'm running 1.4.1.

Nick_vh’s picture

Since we would be able to find out the version number #1336324: Get Solr version number to determine feature sets like facet ranges and location search we could actually allow this configuration option in the search environment if solr 3.4 is found.
Solr 1.4 would stay unsupported

Nick_vh’s picture

Title: Optional support for EDismax » Add configuration option to a search page if we want Dismax or EDismax.

Changing title

Nick_vh’s picture

Title: Add configuration option to a search page if we want Dismax or EDismax. » Add configuration option to a search environment if we want to use Dismax or EDismax.
Nick_vh’s picture

Status: Active » Needs review
FileSize
1.95 KB

Just made the change to handle dismax/edismax through configuration. The patch does not handle difference between solr 1.4 and 3.4 yet. It is tricky because at the time you are configuring the server there is nothing known yet about the server unless it is online?

Any ideas?

pwolanin’s picture

Status: Needs review » Needs work

I would only call addParam if the value is set - for unset do nothing.

Also, we should not add it to the UI - instead maybe a drush command to set and environment variable value?

Nick_vh’s picture

Change to a apachesolr_variable_get and set

Nick_vh’s picture

FileSize
874 bytes

Changed to a apachesolr_environment_variable_get with a default fallback to the query itself.

If you know that a certain environment is 3.4+ or edismax is enabled you can 'as a site developer' add an option to the UI if you want. As a precaution towards site builders we will not add this option to the UI ourselves.

Nick_vh’s picture

Status: Needs work » Fixed

Committed

Nick_vh’s picture

Status: Fixed » Closed (fixed)
Nick_vh’s picture

Version: 7.x-1.x-dev » 6.x-3.x-dev

Committed this exact patch to 6.x-3.x