Hi, I can't figure out why the "direct parse mode" isn't available in Views, only in Search Pages. The "search keys" behavior of breaking up the query on whitespace and putting quotes around each term is not compatible with my dismax setup in Solr, so I need to be able to just pass the query string unaltered.
For that matter, I'm not sure why anybody using Solr with dismax would want Search API to do this to their query, since the whole point of dismax is to accept a raw user query and do something smart with it, right?
Any pointers? The direct parse mode in my Search Pages setup is working nicely, but I need the extra level of control that Views gives me. Thanks!
Joel
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | 1697246-13--views_parse_mode.patch | 4.92 KB | drunken monkey |
| #8 | 1697246-8--views_parse_mode.patch | 2.13 KB | drunken monkey |
Comments
Comment #1
noahadler commentedI'd like to know the answer to this as well. Sounds like you are farther along than I am, but I'd like to know better how to customize my parsing, and have it apply across the board, especially with views. Seems like the API aspect of Search API gets a little grey in this area.
Comment #2
jonloh commented+1 as this is for wildcard search with Views.
Comment #3
mattp52 commented+1 to all of the above. Does anyone have an elegant workaround to this? I haven't found a method in the SearchAPI class for setting the parseMode in an alter hook.
Comment #4
krlucas commentedI was able to get this to work by just creating my own filter that extends the existing fulltext handler with a minor override.
Here's the gist: https://gist.github.com/krlucas/5568644
Comment #5
rooby commented@krlucas:
If you added to that code an option in the interface to switch it on and off and make it apply to all indexes it would be pretty close to a patch that could get committed so you and others don't have to work around it again in future.
Comment #6
krlucas commented@rooby
Yeah totally. I just wanted to post what I had so far!
Comment #7
rooby commented(nice work by the way :))
Comment #8
drunken monkeyWriting a patch would probably have been faster and would have had more effect. But still, thanks for bringing this topic/issue back up.
Attached is a patch adding a "Parse mode" option to the query settings. Please test/review!
Comment #9
krlucas commentedThanks @monkey! You're probably right but then maintaining patched modules on client projects has its own downsides. Most maintainers aren't as responsive as you are. Plus it took me hours just to discover the concept of parse modes. :-)
Comment #10
krlucas commentedTested and this works for me against the latest dev. I kind of expected the setting to be in the full text filter settings though. Does it make sense to also update the Search Keys radio button in the filter from "Search Keys - multiple words will be split and the filter will influence relevance." to something else?
Comment #11
drunken monkeyYes, I guess that would make more sense. However, from the code perspective it's more logical like this, and also we'd have to duplicate the setting otherwise since the Fulltext Search contextual filter also can be used to add search keys.
But maybe we can a) change the description for the filter setting to refer users to the query settings and b) also add a short documentation of this to the README.txt.
Good to know it works for you, though, in any case.
Comment #12
krlucas commentedOh right, parse mode is query specific.
Makes sense to me.
Comment #13
drunken monkeyOK, here is a revised patch. The code is the same, only some UI strings and the README.txt were changed compared to the last patch. Please see if these changes make sense to you and I'll commit.
Comment #14
drunken monkeyComment #15
eljakeo commentedI tried out #13 on my own site and it worked great. I'm a Drupal n00b, so I don't feel comfortable marking it "tested and reviewed," but at least in my case it worked great.
Comment #16
drunken monkeyThanks for testing!
In this case, this is even kind of an advantage – you could tell me, whether the new README text makes sense to you:
Does this text help you understand this option, or does it create more questions than it answers?
Also, would you be able to find this new setting with the text added to the fulltext filters?
You can change how search keys are parsed under "Advanced" > "Query settings".Other than the documentation, this patch seems fine, so if that part works, too, I'll commit it.
Comment #17
eljakeo commentedWell, I didn't want to admit this so as to underscore my "n00b-ness", but it did take me a couple of minutes to figure out what section of the UI you were referring to. I still figured it out, and once I found the setting I had no issues. My suggestion to clarify for individuals such as myself would be something like:
"You can determine how search keys entered by the user will be parsed by going to "Advanced" > "Query settings" within your View's settings."
The reason I say this is the first place I looked was in the Search API settings on the Configuration screen and that's what made it take slightly longer. Other than that, I found the documentation to be perfectly clear.
Comment #18
drunken monkeyOK, thanks for the suggestion! I added that clarification and committed.
Thanks again for testing!