Closed (duplicate)
Project:
Search API
Version:
7.x-1.x-dev
Component:
Plugins
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
17 Feb 2015 at 13:32 UTC
Updated:
6 Oct 2015 at 13:30 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
broonI actually got this problem with the "Apache Solr Search" module, "SearchAPI" with "SearchAPI Solr" work fine for me.
The former is called through
/search/site(opposing to Drupal core search at/search/node, which works fine as well by the way).For example, on an archiving website we are digitalizing and storing old school files (as in a filing cabinet). The corresponding nodes' titles just have the original file ID, e.g. "2012/08/634" for the 634th case of August 2012.
Entering that title into the Drupal core search results in
/search/node/2012/08/634and the correct file pops up in the results list.Accessing Apache Solr Search, entering "2012/08/634" in the text field and hitting enter leads to
/search/site/2012%252F08%252F634, so this time it's urlencoded but it shows the correct result as well.The SearchAPI Search page created with views is located at
/supersearchand putting the title in the search term box results in/supersearch?find=2012%2F08%2F634showing the correct file.Now comes the catch. On all three searches, there is the filter for content type. Clicking on a content type to filter the results, leads to different behaviour.
For example, clicking on "medical" in SearchAPI Search leads to
/supersearch?find=2012/08/634&f[0]=type%3Amedical, still showing "2012/08/634" in the search box and the file I am looking for in the results list.For the Drupal core search, I am redirected to
/search/node/2012/08/634%20type%3Amedical. The search box now reads "2012/08/634 type:medical" and shows the correct file.However, Apache Solr Search leads to
/search/site/2012/08/634?f[0]=bundle%3Amedical(which looks correct). The search box however only contains "2012" instead of the full search term "2012/08/634". The results list is full of files from 2012, the file I am looking for is not even on the first page of search results.My setup:
Drupal 7.34
SearchAPI 1.14
SearchAPI Solr 1.6
Apache Solr Search 1.7
Comment #2
drunken monkeyI cannot reproduce the behavior from the original post. (The one in #1 describes a bug in Apache Solr Search, so should maybe be reported there.) Please provide more details so I'll hopefully be able to reproduce the problem.
The only irregularity I could find is when you use a contextual filter for the keywords – then, of course, a slash in the keywords will lead to the keywords being truncated to the portion before the slash (and if the view has arguments, cdhaos might ensue). That's a problem with Views, though, not with this module.
In no case can I reproduce the missing properties, though.
Comment #3
OWastYeah, #1 is definitely not related.
I'll explore if the views bug you describe could cause this. Otherwise I'll dig a little deeper and see if I can find more info, or a solution.
Comment #4
OWastTurned out that the culprit was the highlighter. It performs a regexp on the keywords that can't handle forward slashes. It might be better to rewrite the regexp, but here is just adding an escape for the / character.
Comment #5
OWastComment #6
drunken monkeyHuh. Curious. In theory, that's exactly what the
preg_quote()calls in the line above your change are there for. In my tests, your patch even broke this again, since it changed\/to\\/– i.e., instead of an escaped slash, an escaped backslash followed by the end of the pattern.Could you maybe try out what
$keyscontains before and after both that line and your new one? I can't really understand how that might be the problem.Otherwise, escaping would of course be the correct solution – I just really thought we already did that. (Also, using
preg_quote()is a better way to escape the keys, since otherwise you run into exactly the same problem with other PCRE special characters.)Comment #7
OWastTrue dat! Very weird. The preg_quote should do it. But:
Comment #8
drunken monkeyWeird stuff. I now tested the complete setup (previously I just tested whether that statement works), but I still can't reproduce this problem. From how it looks to me, this shouldn't be possible. (I also couldn't find any reference to the
$delimiterparameter ofpreg_quote()being absent in earlier PHP versions, which I considered as the sole possible reason.)Please try to find out how this is going wrong in your setup, and how we might fix this properly (if necessary). Please also try the latest dev version of the Search API, if you haven't already – maybe that will fix it?
Comment #9
OWastOkay, I understand the problem now.
The preg_quote in 1.11 specifies no delimiter:
The current dev, however, does:
Since the forward slash isn't an actual regex special character, it's not escaped in the first version.
This is fixed in 2168713
Sorry to bother you, I should have tested with the latest version before I started digging in this again.