If officers search your body or your property, you have some rights. The Legal Information Institute explains you do not need to consent to the search because the U.S. Constitution gives you the right to be secure in your person and property. If you refuse a search, officers must get a warrant to allow them to do so without your permission.
You should keep in mind, though, there are some exceptions.
In general, officers can search your body or pat you down when arresting you without your consent. The goal is to find any type of item that could cause harm or illegal substances.
Once you are in jail, you also lose the right to be secure. Officers can do body searches or searches of your property at any time.
During a crime
There are some situations in which officers can do a search of your property without a warrant. For example, if a crime is happening or they are coming to render aid to you, they can come into your home without permission. For example, if you call because someone is breaking into your home, officers can come inside and look for the criminal or look for victims because you called for their help.
If while in your home, they find something related to criminal activity, they can use that knowledge. However, when they stumble upon criminal activity within your home while there for something unrelated, they cannot freely look about without your permission. They would still need to get a warrant.
If you do not consent to the search and the officers have no legal basis upon which to perform a search, you can get any evidence they collect thrown out in court. They cannot use illegally seized items as evidence against you due to the violation of your rights.