AI OnAI Off
Hi,
Joel Abrahamsson has written a post of how to do wildcard queries: http://joelabrahamsson.com/wildcard-queries-with-episerver-find/
Best Regards,
Henrik
Hi,
The solution outlined in the post doesn't solve my exact problem. You still need to specify the fields you want to search against, but my problem is that the pages types that I have to search against do not share a common set of properties. This is why I use the '_all' field.
Having said that, it isn't much of a change to alter the 'WildCardQuery' extension method to fit my requirements. I just remove fieldselector expression parameter and default to the '_all' field.
Thanks
I am working on a project where we have moved from the standard episerver seach mechanisim to episerver find.
We needed to be able to use wildcard searching, but due to the nature of the pagetypes we where searching across we could not use the .Filter(f => f.PageName.Prefix(this.SearchTerm)), the properties we needed to search against where not consistent across all the pagetypes.
We where forced to the the .For(this.SearchTerm) method, but it isn't possible to force a wildcard search.
After looking at the documentation I knew that the .For() method works against a specific field '_all', so all I needed to do was use the Filter() method, and then specify this field.
.Filter(new PrefixFilter("_all", this.SearchTerm))
The line above allows makes the query perfom a wildcard search on the '_all' field, just what I needed to do.
Hopefully this will help, but interested to get peoples thoughts on other possible solutions.