I'm working with the smart search API and am stuck trying to find a way to return ALL documents from a given index.
I've found a couple of similar questions on here (like this and this) but neither answer seems to show how to return all documents.
Specifically what I want is to be able to set up a SearchParameters object with the usual environmental properties like culture, path, class names etc, but to not provide a search term. I'm finding that setting the SearchFor property to empty string or null both result in no documents being returned.
SearchParameters
SearchFor
At the moment I'm implementing this in a way which feels very much like a hack by setting parameters.SearchFor = string.Format("documentculture:\"{0}\"", currentCultureCode) meaning I'm returning all documents for the current culture. There must be a more elegant way!
parameters.SearchFor = string.Format("documentculture:\"{0}\"", currentCultureCode)
Hi Nat,
The smart search won't work, if SearchFor is empty. But if you don't want to use some hardcoded field name and find all documents, you can use *:* string for this property
*:*
Thank you Anton, that works well.
Please, sign in to be able to submit a new answer.