Currently if I use the "Exclude specified items" filter and mess up my regex, I get a ton of notice errors on the screen. It would be great to have a checkbox that flags whether a string is a regex which would allow for simpler strings (i.e. "tes*" instead of "/^tes*/") and would eliminate notice errors if the regex was botched. This design pattern is common in IDEs and text editors.

CommentFileSizeAuthor
#1 facetapi_bonus-1388738-1.patch2.49 KBcpliakas

Comments

cpliakas’s picture

Status: Active » Needs review
StatusFileSize
new2.49 KB

The attached patch is a first crack at the functionality.

danielnolde’s picture

Status: Needs review » Active

Aahh, i see your point, Chris - but the point of the mechanism as it is working now is to enable the user to define a mixed comma-separated list of items for exclusion, some of which maybe regexp, some maybe not. We can quite safely presume that a) almost no facet item value itself starts with a slash, and b) a user inputting regexp as exclude items can be thought of self-responsible and experienced enough to handle this at his own 'risk'.
So your patch would bring a nicer user interface to people (those using regexp here) who are well used and adapted to rather spartanic interfaces, while trading off flexibility, which is currently already used in projects.
I rather opt for conserving the existing flexibility here.
Does this sound reasonable?

danielnolde’s picture

Status: Active » Closed (won't fix)
danielnolde’s picture

Status: Closed (won't fix) » Active

Thought about this again: You are right, chris. My own argument works against my reasoning: If a user chooses to make the whole list regexp-syntax, then he can be assumed to be experienced enough to escape regexp-special-chars himself, and so the flexibility to also list specific single exclude item along with regexp items is kept (only the application and consideration of special syntax is reversed).
Using the special syntax of " and "" supported by drupal_explode_tags(), we should even be able to input a list of regexp expressions which by themselves make use of the " character and the comma character - right?
I'll apply your patch in a minute.

I also just made you co-maintainer of Facet API Bonus, which makes sense given your valuable input and your insight as maintainer of Facet API.

danielnolde’s picture

Status: Active » Fixed

Done. Also ported all this for the FacetapiDependencyFacet plugin.
Thanks for the input, Chris!

cpliakas’s picture

I also just made you co-maintainer of Facet API Bonus

Thank you! I definitely want you to drive this module though, and I will still propose changes via the issue queue for your final approval and review. I think it is incredibly valuable to bring in different maintainers and ideas into the Facet API project and Drupal as a whole. I look forward to the progress of this module. Great stuff so far.

~Chris

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.