Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I created a search block that was configured to search several content types. I used Dropdown list to show content types. When I did a search, the results page listed contents from all content types and the URL was `http://mysite.com/search/node/lorem?f%5B0%5D=bundle%3Anews` (`lorem` was the search term and `news` was the content type). By the way, I'm using apachesolr for the search. I looked the query passed to solr, the parameter `q=lorem` though `fq` (filter query) was empty.
It seems to that the `bundle` parameter was not passed to solr.
Any ideas? Thanks in advance.
Comment | File | Size | Author |
---|---|---|---|
#8 | 0001-2425059-fixed-use-OR-instead-of-AND-for-Solr-type-fi.patch | 1.1 KB | jdanthinne |
Comments
Comment #1
jdanthinne CreditAttribution: jdanthinne commentedI think this has been fixed in Custom Search 7.x-1.17. Can you try this version?
See #2297015: Path generated for apache solr filters doesn't resolve.
In general, always try with the latest (or dev) version available before reporting a bug.
Comment #2
kuangshi.yan CreditAttribution: kuangshi.yan commentedThanks for your response.
You're right the bug can be fixed by using `fq`, however in the last release (or dev) version (7.x-1.7 or 7.x-1.x-dev) it's always `f` being used. Can you check it ?
Thanks.
Comment #3
jdanthinne CreditAttribution: jdanthinne commentedStrange, the commit hasn't been taken. I've just re-pushed it to dev.
See http://cgit.drupalcode.org/custom_search/commit/?id=42188d0
Comment #4
ngocketit CreditAttribution: ngocketit commentedIs it working now? It still doesn't seem to work for me. The query passed to Solr doesn't contain filter query for bundles. In the latest release version 7.x-1.18, fq is used instead of f. Here is the code:
Comment #5
ngocketit CreditAttribution: ngocketit commentedI just figured it out myself. It's not because of custom_search but a setting in Apachesolr module that prevents manual faceting passed thru the URL. Enabling it and the bundles are passed to Solr successfully. However, is there any way to use "OR" operator for the bundles? For example, I want to search nodes of either "page" or "event" content type. Currently, bundles seem to be "AND"ed.
Comment #6
jdanthinne CreditAttribution: jdanthinne at Synthèse commentedI'm not used to Solr so let me know (or provide a patch) how the query should be modified to have OR, and I'll do my best to implement that.
Comment #7
ngocketit CreditAttribution: ngocketit commented@jdanthinne: Currently, we're having something like this: fq[0]=bundle:event&fq[1]=bundle:page, which will result in "AND" to be used. For "OR", it would be like this instead: fq[0]=bundle:(event OR page).
Comment #8
jdanthinne CreditAttribution: jdanthinne at Synthèse commentedCan you try this patch and tell me if it's what you need?
Comment #9
krrishnajee CreditAttribution: krrishnajee as a volunteer commentedI waste my whole day to figure out this, but end of the day it's just a checkbox tic :) thanks @ngocketit