Expand my Community achievements bar.

Join us January 15th for an AMA with Champion Achaia Walton, who will be talking about her article on Event-Based Reporting and Measuring Content Groups!

Building a segment to find multi-word search queries

Avatar

Level 1

I have a dimension that gives me search queries, most of which are one word ... but I want to find all those that are 2 or more words.

I used segment builder to create a filtering on "contains" for " " and ' '.

The end result is the system delivers only queries that contain either ' or "  - interesting that this exists but absolutely not what I wanted.

DerekRe6_0-1736958950952.png

Any ideas????

4 Replies

Avatar

Community Advisor and Adobe Champion

Lol, yeah, unfortunately, the segment builder is looking at the literal " or ' text... there is no "advanced" way of searching for an actual space... at least not here.

 

You could create a classification on your Search Query dimension though, and use regex to identify if there are spaces.

 

So I did a quick test, using regextester.com:

Jennifer_Dungan_0-1736961150994.png

 

 

You can also check for "no space":

Jennifer_Dungan_1-1736961615630.png

 

 

This will match if there is any space...  So if it matches, this should mean there is more than one word (unless the search query was " something" or "something " and the space wasn't trimmed from the from or end of the query)

 

So, in your Classification, I would first put in a catchall (or specifically use the no space regex), that sets the "has multiple words" (whatever you call it) to "no" or "false" or "single word" however you want to indicate that, then check for space, and set the classification to the opposite ("yes" or "true" or "multiple words").

 

If you need to get fancy and look for the number of words, I don't think you can get a count out directly, but you could get fancy and look specifically for one space, two spaces, three spaces, etc... then have a "5 or more" rule at the end.

 

However you end up setting it up, know that Classifications process every 4-6 hours, so you can't use it on "today's data" too reliably... but your classification rule can process up to 6 months of data in the past, so you should be able to have a history available to you once the initial processing is complete.

 

Now, when you create your segment, instead of using your Search Query dimension directly, you can use your new classification, and look for "yes" or "true" or "multiple words", or whatever value you set when there is a space.

Avatar

Community Advisor and Adobe Champion

Now, depending on your needs, a classification may be a lot of work...

 

You could also just use the filter option on your table to search for space?

 

Jennifer_Dungan_0-1736963464349.png

(There is a space there, you just can't see it)

 

 

It works for me on my Search Keywords dimension.

 

 

However, if this needs to be combined with other uses, like "percent of searches with multiple words" or something else that requires the use of a segment, then the classification thing is probably your only option (short of adding a new JS solution in Launch to evaluate the number of words in the search and pass that as a new dimension)... 

Avatar

Community Advisor and Adobe Champion

Is there a reason you didn't just put a space in the segment builder without the quotes? Using a space in the segment builder does work.

Just do what you were doing, except get rid of the quotes, just put a space.

MandyGeorge_2-1736964342841.png

 

 

Avatar

Community Advisor and Adobe Champion

Lol, so it does... I swear it used to trim whitespace and not accept a space on its own.. I figured that was why they were trying to use " ".

 

Yeah, no need to use classifications then... unless you need to get groups by number of words (1 word, 2 words, 3 words,....  5+ words)