Closed (fixed)
Project:
Apache Solr Search
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
4 May 2009 at 07:14 UTC
Updated:
21 May 2010 at 21:30 UTC
I would like to search for multiple node types; e.g. return all nodes with 'test' of type blog and page.
With solr, fq=[blog page] does work:
http://localhost:8983/solr/spawar/select/?q=test&version=2.2&start=0&row...
In function filter_extract() need to match this pattern, so that $filter is not broken up before the space only, and so that make_filter() does not convert [ to "
The following patch only takes into account if there were 2 types searched for, I haven't figured out how to write the regular expression for more.
| Comment | File | Size | Author |
|---|---|---|---|
| apachesolr_multipletypes.patch | 753 bytes | aufumy |
Comments
Comment #1
JacobSingh commentedUnfortunately such as regex is impossible AFAIK.
It would need to be a 2 step process, match and then find :( perhaps we should use anonymous functions for pattern extraction instead of an array of regexes?
Comment #2
pwolanin commentedhow about
fq=type:(blog OR page)This at least works from the Solr admin interface, and shoudl work from within the module - though I'm not sure whether the parser will handle that right in the URL.
Comment #3
pwolanin commentedhttp://www.nabble.com/Filter-Query-with-multiple-values-td23409351.html#...
Comment #4
aufumy commentedTesting out a different regex, and with more than 2 types, tested 3 and 4:
$patterns[] = '/(^| |-)'. $name .':([\[\(](\w+)(\s+OR\s+|\s+)(\w+)(.*)[\]\)])/';While this regex does breakup both "type:(blog OR page OR story)" and "type:[blog page story]" the 'OR' version actually returns search results when using the module
* either manually typing in the url such as
/search/apachesolr_search/language?&filters=language%3A%28en%20OR%20ar%20OR%20de%20OR%20ru%29
* using a code snippet below (which depends on patch in http://drupal.org/node/449414)
Comment #5
jpmckinney commentedIn 6-2.x, you have OR facets to do this. I don't think this will be backported.
Comment #6
ebeyrent commentedHere's one way to implement filtering by multiple content types, as suggested in #5:
Comment #7
jpmckinney commentedExcellent. I'm switching to support request as the issue is now about how to do OR faceting in 6.x-1.x, not about backporting 6.x-2.x features.