Natively, in Cloud Firestore you can't ensure uniqueness of data from neither Rules or the SDK. Although I believe that the following links will help you to achieve this, as they apply to similar use cases:
The accepted answer(credits to Frank van Puffelen) in this Stackoverflow Post explains how to achieve what you want with a workaround.
Check also this article in which the approach is quite simple.
Generally in order to check uniqueness you should make a collection "X" in which every document corresponds to an "x" value that you need to be unique. The documentID of each document in the collection should named after the value you want to be unique. Thus when you try to save your search results to Firestore, check the "X" collection to see if there is a documentId that fits the search results you would like to add every time. If the documentId doesn't exist then you add the search results to your collection. The misconvience in your use case is that the documentID of the document should contain the message as a name in order to work.
Let me know if this was helpful.