Can anyone shed light on how to achieve this initialization or a workaround? I am trying to initialize the SearchResponse object before a conditional loop and populate the object inside the loop. The motivation is to make my code concise and easily maintainable.
Thank you, David. I must initialize the searchResponse object here (rather , then inside of the if loops), so that I can reference the object to calculate totalHits, elapsed time and facets (aggregation) data from the response after the if-loops. Otherwise, I will need to create the searchResponse object inside of the if loop that executes and will need to include the code that calculates totalHits, etcetera multiple times - once inside of each if loop.
Ended up just calling a new function that wraps together the lines of code that compute totalHits, elapsed time and aggregation data. Now I just call that one function in each conditional.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.