We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am receiving an error from Solr when trying to filter results on the Content field of SiteTree. Specifically:
org.apache.solr.common.SolrException: undefined field SilverStripeCMSModelSiteTree_Content
I am adding the filter by using the SearchQuery class, like so: (simplified example)
SearchQuery
$query = new SearchQuery(); $query->addFilter(SiteTree::class . '_Content', 'filter text'); $index->search($query);
It looks like this issue is caused due to a missing call to SolrIndex->sanitiseClassName in SolrIndex->getRequireFiltersComponent.
SolrIndex->sanitiseClassName
SolrIndex->getRequireFiltersComponent
You can see an example of where the field name is being sanitised correctly in SolrIndex->getExcludeFiltersComponent here: https://github.com/silverstripe/silverstripe-fulltextsearch/blob/master/src/Solr/SolrIndex.php#L965-L970 which is what lead me to believe it was missing in getRequireFiltersComponent
SolrIndex->getExcludeFiltersComponent
getRequireFiltersComponent
Edit: I am using silverstripe/fulltextsearch version 3.4.1 but this issue appears to affect newer versions too
silverstripe/fulltextsearch
3.4.1
The text was updated successfully, but these errors were encountered:
I should note I can workaround this issue by sanitising the class name myself before I call SearchQuery->addFilter, e.g.
SearchQuery->addFilter
$query = new SearchQuery(); $fieldName = SiteTree::class . '_Content'; $sanitisedFieldName = (new MySolrIndex())->sanitiseClassName($fieldName); $query->addFilter($sanitisedFieldName, 'filter text');
Sorry, something went wrong.
Related #269
No branches or pull requests
I am receiving an error from Solr when trying to filter results on the Content field of SiteTree. Specifically:
I am adding the filter by using the
SearchQuery
class, like so: (simplified example)It looks like this issue is caused due to a missing call to
SolrIndex->sanitiseClassName
inSolrIndex->getRequireFiltersComponent
.You can see an example of where the field name is being sanitised correctly in
SolrIndex->getExcludeFiltersComponent
here: https://github.com/silverstripe/silverstripe-fulltextsearch/blob/master/src/Solr/SolrIndex.php#L965-L970 which is what lead me to believe it was missing ingetRequireFiltersComponent
Edit: I am using
silverstripe/fulltextsearch
version3.4.1
but this issue appears to affect newer versions tooThe text was updated successfully, but these errors were encountered: