Split categories by 1st dash

Hello,

When I publish an event to a stream name “instrument-name-with-dashes”,
I can see a projected stream “$category-instrument-name-with” created.

So, it looks like categories break the stream name by the last dash.

Is it possible to make break on the first dash instead, so that the projected stream is named “$category-instrument”?

Also, are there any characters that are not allowed to be in a stream name?

Thanks,

Igor.

It’s not right now, that’s actually on the to do list for Monday. Expect it to be in trunk shortly!

By the way if you’re actually using GUIDs then formatting them without the dashes is a short term fix (.ToString(“N”) in .NET)

Cheers,

James

Unfortunately, they are not GUIDs, but rather instrument IDs that can contain all kinds of punctuation. And removing punctuation will lose uniqueness. :frowning:

Which is why I need to figure out what characters are not allowed or have special meaning in stream names.

Igor,

I’ll push support for some flexibility in categorization support on Monday/Tuesday.

However, even with yesterday sources you should be able to replace ‘-’ as category separator with another separator. (Earlier versions do not support it).

Go to edit projection query of the system projection (the same way as you edit JS query) and replace the single dash character in the query with the separator you need. The restart the projection. You need to do it for both categorization projections.

The only known problematic symbols in stream names are slashes. Due to kind of impossible to pass them via URL in mono.

kind regards

Yuriy

Thanks for the info.

Unfortunately, when I click on ‘Edit’ for the $by-category projection, the source window contains only a single dash. :frowning:

Another question, how do I automate creating custom projection and / or adjusting system ones? Do I have to do an HTTP POST?

The dash is the separator, you can edit to change it.

Yes to automate creating a projection you can use PAdmin which wraps an http API (you can also use the API directly)

Ahh, got it.

I was expecting to see the usual projection code.

Working now. Thanks.

That projection is implemented internally (not in js)

Igor,

the upcoming EventStore release supports configuration for either first or last category separator occurrence.

The categorization projection configuration (query/source) allows:

a) single line: just one separator must be supplied

b) two lines: first line must be either first or last keyword and the second line just a single separator character

For the newly created database it is important to reconfigure projections before enabling them. Note, that there are two standard categorization projections that must have the same configuration.

-yuriy

Thanks for all the info.

I’ve just reconfigured the one in 2.0.1 release to use different separator.

Works like a charm.