Details
-
Bug
-
Resolution: Fixed
-
Minor
-
13.10.5, 14.3
-
None
-
Unit
-
Unknown
-
N/A
-
N/A
-
Pull Request accepted
-
Description
When using an equals comparison with an empty string in SimpleEventQuery, the generated Solr query is invalid as Solr doesn't like it when the value is empty, see this Stack Overflow question for details. Groovy snippet to reproduce:
{{groovy}} def eventStore = services.component.getInstance(org.xwiki.eventstream.EventStore) def eventQuery = new org.xwiki.eventstream.query.SimpleEventQuery(0, 30) eventQuery.eq(org.xwiki.eventstream.Event.FIELD_DOCUMENT, '') try (org.xwiki.eventstream.EventSearchResult searchResult = eventStore.search(eventQuery)) { println("Total result: " + searchResult.getTotalHits()) } {{/groovy}}
Root cause of the exception: Caused by: org.apache.solr.parser.ParseException: Encountered "<EOF>" at line 1, column 15..
As a workaround, eventQuery.not().less(org.xwiki.eventstream.Event.FIELD_DOCUMENT, null) can be used to search for events without document.