Hi,
Recently I noticed that, when using the quicksearch in Service, it does no longer search in the messages, but only in the request title.
So:
- Am i mistaking, and has it never searched for message content?
- Or is it something you can activate? And how ;) ?
Regards,
Niels
All Replies (7)
Don't think it searches for content - only title:
https://community.superoffice.com/en/customer/learn/service/find/how-to-use-quick-search/
But you can modify it:
https://community.superoffice.com/en/blog/expanding-quick-search-functionality/
Hi Frode,
Indeed it is quite easy to modify the quicksearch and add your own stuff.
For searching on message body / content, it seems a bit trickier.
I tried the following, but it returns all the requests..
String s = getCgiVariable("HtmlPage_quickSearch");
if(s.find("txt:") >= 0) {
String q = s.after(":");
setVariable("url",getProgram(1) + "&action=searchTable&ok=1&table=ticket&field.0=ticket.(ej_message->ticket_id).body.0=" + q);
}
Hi Niels, try this:
if (search.beginsWith("txt:"))
{
String content = search.after("txt:");
String url = getProgramTicket() + "&action=searchTable&ok=1&table=ticket&field.0=ticket.text&operator.0=7&value.0=" + content; //Operator 7 = contains
setVariable("url", url);
}
Hi Frode,
Wow that works great! this ticket.text field is very nice for these purposes.
I am trying to get a step further now, searching for a combination of words.
Therefor I want to use the syntax txt1:frode,txt2:boss
This should give a list of all requests where both words "frode" and "boss" are used.
I have created the following, but it gives me a list where either one of the words is used instead of both.
if (s.beginsWith("txt1:"))
{
String content1 = s.after("txt1:").before(",txt2:");
String content2 = s.after("txt2:");
String url = getProgramTicket() + "&action=searchTable&ok=1&table=ticket&field.0=ticket.text&operator.0=7&value.0=" + content1 +"&field.1=ticket.text&operator.1=7&value.1=" + content2; //Operator 7 = contains
setVariable("url", url);
}
This results in:
scripts/ticket.fcgi?_sf=0&action=searchTable&ok=1&table=ticket&field.0=ticket.text&operator.0=7&value.0=frode&field.1=ticket.text&operator.1=7&value.1=boss
Is this something in the Operator function in the url?
Hi Sverre,
Thanks, but don't I need to get an "and" between my criteria, since it needs to find requests where both words are found?
You are right. I read a bit too fast...
I am not sure how to get ticket.text contains Foo AND ticket.text contains Bar. I would have to research that a bit deeper. I think there are some issues because ticket.text translates to (ticket.title contains OR ej_message.body contains). Unfortunately, I cannot look at this right now as it would take some time...
Sverre