Search

I have a Data Source that I want to filter with using regexp:{$url-q} acting as a search. However I want to filter two fields, Name and Author, both of which are text inputs. If I add the filter to both fields it will create an AND where both must match my text. Is there a native way, or an obvious hack, to allow for an OR that spans fields?

The alternative solution is to concatenate both Name and Author into a "Search" field upon entry saving (by modifying the event PHP) and then searching on this field. Not ideal, but acceptable.

Have you looked at the reflection field extension?

Thanks carsten, I had forgotten about this field. I can use this to create a concatenated Name+Author field and then run my regexp on that field. This is fine, but I wonder whether there'd be scope for developing the DS Editor further to allow for ORs rather than multiple filters compounding an AND query.

Currently, many joins are used anyhow. So, I think it should be possible to modify the DS Editor to include fields from different sections.

I went with Rowan’s Reflection field which concatenates the Name and Author into a new textarea named “Search”. It means redundant data (across 180,000 entries!) but it’s the only option I have without writing custom SQL.

Since it’s not in the core, this would be solved by a search extension.

I would like this to be discussed further. Other ideas aside from the reflection field?

Search across fields? (Or member management?) Seems to be solved here! I am waiting for some cool extensions from the dev team to pop up.

Search across multiple fields. Or more to the point, the ability to specify OR filters rather than all filters compounding to a single “AND” query.

Once the forum is released as an ensemble we’ll be able to pick it apart and see how it was done ;-)

Dear Forum Ensemble,

We will DISSECT YOU!

Sincerely,

Eager Beaver

Yum yum.

Just stopped in to ask, is anything happening with these OR filters? I’ve looked around and it seems the last anyone talked about them was in May ‘09? I can’t wait till this is implemented.

Waiting hopefully…

Because of the complexities and possible breakage of backwards compatibility I’m not sure you’ll see these anytime soon.

If you don’t mind writing PHP I have an extension around the corner which does make OR between two or more fields possible, but you’ll need to write a very short custom DS to use it.

That is a step in the right direction for sure. I assume OR functionality wouldn’t be used many times on a site, but I bet it will be used on many sites, if only the one time.

(Bump)

I currently have need for this functionality. My page is /components/ and I need to filter Products on category OR (if available) category and title.

(‘Components’ itself (the current Page’s title) is a category, so I specify this as a fallback.)

I’d like to use 1 page with 1 DS for:

  • /components/ (no (sub-) category given, show all products with ‘component’ category.
  • /components/subcat/ (Sub-category given, show all products with ‘sub-cat’ category.
  • /components/subcat/subsubcat (Sub-category given, show all products with ‘subsubcat’ category.
  • /components/subcat/[subsubcat/]product-title (title given, show 1 product)

This seems quite standard behaviour (use 1 DS for both master/detail views).

The following page parameters (for the Components page) are set: category/category/product

Note: I use 'category' twice (allowing the $category to be a first-level or sub-level category). I’ve limited my params to max 2 levels of categories, excluding the default ‘components’ category.

Note: Remember that the current Page’s title (‘components’) is a category in itself, I’d like to filter my DS on ‘components’ by default.

Here’s the thing: My DS filter looks like this: {$category:$current-page} (where $current-page = ‘components’).

This filters all Products on either (sub)category (if present) or (as a fallback) on ‘components’ category.

This is fine but what I really need is to add a title

Pseudo: (title = {$title}) OR (category = {$category:$current-page})

Is there an easy way of doing this in Symphony or do I need to use an extensio such as Field:filters

Thanks!

If you don’t mind writing PHP I have an extension around the corner which does make OR between two or more fields possible, but you’ll need to write a very short custom DS to use it.

Nick, have you ever finsihed this?

[EDIT]: Never mind. I think I am gonna solve this using your SymQL extension.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details