Closed (fixed)
Project:
Search API Solr
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
10 May 2011 at 21:58 UTC
Updated:
4 Jan 2014 at 00:53 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
drunken monkeySee here for a review of the module in general: #1157404: Module review.
As stated there, this seems to work fine and it's a great start. However, as for the module, I also have a couple of concerns with the patch that should be addressed before I can commit it.
The README.txt needs to be updated regarding the supported third-party features.
This shouldn't state the file, but have a short description of its contents (i.e., the class).
The class also needs a doc comment.
The helper method doesn't seem to be necessary, as it is called only once anyways. Just inline it in the constructor.
You also shouldn't use
stdClassas a type hint, but only interfaces (but of course this is moot when the method is removed).Comments should use proper punctuation and capitalization.
Use "&&", not "AND". But the whole line could also just read
if (!empty($options['search_api_spellcheck'])) {.Should check whether the query option was set, not just whether the module exists. (Or, maybe both, since of course you also want to avoid fatal errors due to an unavailable base class.)
Punctuation/capitalization.
Powered by Dreditor.
Comment #2
Darren Shelley commentedThis looks great. I encountered one issue whilst following your instructions which I’d like to highlight.
Using spellcheck=true at the same time as using using a filter query (fq) directive for me returns no suggestions.
The following queries aim to demonstrate this, they were run against a generated dataset of 50 nodes. The query string in each case was 'test':
Original Call:
FQ in this context highlights which Search API index to use
Original Response
If I remove the Filter query declaration “&fq=index_id:default_node_index “ I receive a more expected result:
Running the original query with ‘Spellcheck Collate’ enabled I also receive my expected response:
Collation appears to has resolved the issue, the documentation hints at a potential reason:
See: http://wiki.apache.org/solr/SpellCheckComponent#spellcheck.collate
I have checked the collate option against a search which doesn’t have a filterquery and the results did not appear to be adversely affected.
My Solr knowledge is too limited to advise that Collation is a solution, however it has worked for me so may be a worthwhile avenue to explore.
Comment #3
JoeMcGuire commentedThanks I have had a go and fixing those concerns with this patch.
!empty($options['search_api_spellcheck']).Comment #4
drunken monkeyQuite good already, attached are some additional fixes. With those, I'd say this is ready to be committed. Although some feedback from others (and from you) would be nice before that.
@ Darren: Couldn't reproduce this, for me this works with or without filter queries. (Also, filter queries will always be used in Solr queries, due to filtering by index – ergo, this otherwise would never work.) Don't really know what could be wrong on your side. (Maybe "test" and "tego" are just too far away from each other to be reliably found? Try to test with something that only misses one letter – e.g., I use "mact" for my devel-generated data.)
I only found one issue with filter queries, namely that they aren't considered when testing whether the corrected term has more results. This could result in you clicking the "Did you mean: …" link and ending up with less results than before, or none at all. However, for normal spellchecking (I tried it with test data) this will rarely be the case, I guess. Also, as far as I know, Google also doesn't get this right – and who better to measure against than them? ;)
Comment #5
drunken monkeyComment #6
Darren Shelley commented@drunken monkey - Thankyou for looking into my particular issue. Following your advice I have since tried to replicate and this is no longer reproducible on my setup. You may be correct in your theory that the distance between "tego" and "test was causing the hit/miss behaviour.
I have removed the collation from my setup and it works fine.
Comment #7
JoeMcGuire commentedThe module has full project status now here:
http://drupal.org/project/search_api_spellcheck
Comment #8
JoeMcGuire commentedWe need to check if these works for both dismax and standard requests in solr?
Comment #9
drunken monkeyOh, you are right, good catch!
I just tried this out, see the attached patch. The primitive approach of just adding the necessary settings to both request handlers seems to work fine. (To test, change service.inc:398 to
$this->request_handler = 'standard';.)Does this work for you, too?
And would you therefore say this can be commited?
Comment #10
drunken monkeyComment #11
drunken monkeyComment #12
Darren Shelley commentedI have tested Drunken Monkeys latest patch alongside release 1.0 of search_api_spellcheck and the dev release of search_api and this works well for me. There also appear to be no adverse affect of including this patch without having search_api_spellcheck enabled.
For anyone interested in testing this patch, I am currently using the following in my make file. You will need the latest version of drush make with the patch to allow p1 patching:
Comment #13
JoeMcGuire commentedPatch at #10 looks good to me and test OK
Comment #14
drunken monkeyExcellent!
Committed this now, thanks again!