Updated: Comment #N
Problem/Motivation
Currently it's not possible to simply add a query SearchApiViewsQuery::condition('field_geo:latlon', NULL, '<>') due the fact that this is translated to:
locs_field_geo$latlon:[* TO *]
This construct seems to be invalid (tested with solr4) and throws an error.
The reason is that locs_field_geo$latlon is a combined field in solr, consisting of
locs_field_geo$latlon_0___tdouble and locs_field_geo$latlon_1___tdouble.
Somehow this interferes with the [* TO *] query construct while other queries e.g. locs_field_geo$latlon:47.5567,7.58494 work.
Proposed resolution
Check in SearchApiSolrService::createFilterQuery() if a location field shall be handled and if the value is NULL, if so adjust the field name to the first solr subfield.
Remaining tasks
Reviews needed.
Figure out if this works for solr3 too.
Figure out if other operator / value combinations have to / can be handled in a similar way to make them work.
User interface changes
None
API changes
None
| Comment | File | Size | Author |
|---|---|---|---|
| search_api_solr-location-field-non-empty-query-support.patch | 1.03 KB | das-peter |
Comments
Comment #2
drunken monkeyDespite appearances, I do commit your patches from time to time, without first bitching about every detail for half a year. ;)
Great job here, also works perfectly fine in Solr 3!
Committed.
Comment #3
das-peter commentedBahaha, thanks! :)
Comment #5
blainelang commentedI'm using the module version with this change to function createFilterQuery and have enabled the LatLong Indexed field exposed filter setting in views "Hide results without a location".
I traced the code and only see the function called for another field that I have indexed.
No matter what field I add as filter to not display the records with missing data, they still return in the results page. Some of the fields I index are taxonomy and even with the filter setting "is not empty" it has no effect on the results.
What am I missing?