[MGNLEESOLR-62] Searching in an undefined field results in an exception stack trace Created: 12/May/15  Updated: 15/Apr/16  Resolved: 27/Aug/15

Status: Closed
Project: Solr Search Provider
Component/s: None
Affects Version/s: 2.2
Fix Version/s: 3.0

Type: Improvement Priority: Neutral
Reporter: Edgar Vonk Assignee: Milan Divilek
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: 0d
Time Spent: 0.3h
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Sprint: Sprint 7 (Kromeriz)
Story Points: 2

 Description   

The Magnolia Solr implementation uses the default Solr query syntax which means that you can search in all defined fields.

We notice however that when you search on an undefined field (in the Solr index) you get an ugly exception stack trace in the logs. E.g. searching in the undefined field 'body' (e.g. https://www.magnolia-cms.com/search.html?queryStr=body:solr) results in:

2015-05-12 13:27:00,171 ERROR earchprovider.logic.model.FacetedSearchResultModel: Error occurred during perform search.
org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException: undefined field body
        at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:424)
        at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:180)
        at org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:90)
        at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:301)
        at info.magnolia.search.solrsearchprovider.logic.providers.FacetedSolrSearchProvider.removeOutdatedIndexes(FacetedSolrSearchProvider.java:443)

It would be nice if these searches would not result in a stack trace because this can easily fill up our logs.

PS: searching on a defined field like 'title' works well (e.g. https://www.magnolia-cms.com/search.html?queryStr=title:solr) however I would have expected that searching in the 'content' field as defined in the customised Solr schema.xml would give search results but it does not give any.. E.g:
https://www.magnolia-cms.com/search.html?queryStr=content:solr


Generated at Mon Feb 12 10:59:43 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.