Forums

Search with a concat alias

Fredolino 09 Dec, 2021
I have in "Fields to retrieve" this concat:
CONCAT_WS( ' ', Haupt.gattung , Haupt.art):Article.title

In the "Where conditions"
are individual queries with "OR".

For example:
(
BEAU.name / LIKE / %{data:search_freigabe_Txt}% / continue
OR
Haupt.art / LIKE / %{data:search_freigabe_Txt}% / continue
OR
Haupt.gattung / LIKE / %{data:search_freigabe_Txt}% / continue
)

In the "Searchable fields":
Haupt.art
OR
BEAU.name
OR
Haupt.gattung
)

The search works by entering individual search terms.
How does the search also work by entering the concat alias?
My setting doesn't work:

(
Haupt.art / LIKE / %{data:search_freigabe_Txt}% / continue
AND
Haupt.gattung / LIKE / %{data:search_freigabe_Txt}% / continue
)
OR
(
BEAU.name / LIKE / %{data:search_freigabe_Txt}% / continue
OR
Haupt.art / LIKE / %{data:search_freigabe_Txt}% / continue
OR
Haupt.gattung / LIKE / %{data:search_freigabe_Txt}% / continue
)

What is the problem?

F.
webbusteruk 10 Dec, 2021
Answer
1 Likes
(
Haupt.art / LIKE / %{data:search_freigabe_Txt}% / continue
AND
Haupt.gattung / LIKE / %{data:search_freigabe_Txt}% / continue
)

The issue above is that you're using one data string to search BOTH Haupt.art and Haupt.gattung columns. Eg if your {data:search_freigabe_Txt} is "canis", both Haupt.art AND Haupt.gattung must contain "canis". So the only result that will show is if it is "canis canis".

If you wanted to search for a concat string containing Haupt.art and Haupt.gattung using one data string, you will have to use Rules list. In the Rules list box, try:
CONCAT_WS( ' ', Haupt.art, Haupt.gattung)/LIKE:%{data:search_freigabe_Txt}%
You need to login to be able to post a reply.