Try our conversational search powered by Generative AI!

Searching with boolean "OR" condition


Hi all,

I have a site with two types of pages - one a standard page with text and a meta page with no content but with properties set in edit mode that act as meta data for the page.

When the user submits a query, I would like to search the contents of the standard page (default search behaviour) and the meta data properties of the meta page, and return them in one result set.

|_content pages
|       |_Page 1          <-- text contains "Sweden"
|       |_Page 2
|_meta pages
        |_Meta Page 1
        |_Meta Page 2  <--- pageData["meta"] contains "Sweden"

So if a user search for "Sweden", I would like the result set to contain standard pages that have the text "Sweden" in the content and I would also like the result set to have meta pages that have the word "Sweden" in pagedata properties. So I need a boolean "OR" operation. i.e) give me standard pages with "Sweden" in text or meta pages with "Sweden" in properties.

I can't see how the standard EPiServer SearchDataSource control with its Criteria settings can achieve this.

Any assistance on this would be greatly appreciated.

Thank You

Nov 19, 2010 13:50

I don't think you need to use criteria at all for this.  SearchDataSource has two methods for searching -- (1) specific criteria, or (2) feee-text.  I think you just need the latter.

The SearchDataSource can do a free-text search of the text of any properties that are marked "Searchable" on the Page Type definition.  So, on your "content pages," I assume you have a "MainBody" or similar XHTML property.  On your "meta pages," you much have some sting properties to reprsent the meta you mentioned.  Just make sure these are all marked Searchable, and the SearchDataSource will find text in any of them.

In this case, don't add any specific criteria to the SearchDataSource.  Just set "sweden" as the SearchQuery and iterate the results.

Nov 19, 2010 15:16

Excellent Deane.

Now that you mention it, it seems so obvious.

Thank you very much.

Nov 19, 2010 15:22
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.