Author Topic: Building The Search Functionality  (Read 23213 times)

Offline upk_singhm

  • Jr. Member
  • **
  • Posts: 88
  • Karma: 0
Building The Search Functionality
« on: December 29, 2014, 01:17:14 PM »
Hi All,
I have a PSDK based agent application and I am trying to build search module for the eServices module to fetch records based on certain criterion:
1. Email To.
2. Email From.
3. Subject.

and a few other criterion, now I am able to get the search result from the Interactions using the Subject/Date/Custom Business attributes, BUT NOT Email To and Email From, has anyone done any work in this regard.

Any help is much appreciated to help identify how to fetch emails if search is based on Email To and Email From parameters.

Let me know if any details are required.

Regards,

Offline Kubig

  • Hero Member
  • *****
  • Posts: 2752
  • Karma: 44
Re: Building The Search Functionality
« Reply #1 on: December 29, 2014, 01:25:29 PM »
You can use Apache Lucene for these purposes. All records are indexed by this software.

Offline upk_singhm

  • Jr. Member
  • **
  • Posts: 88
  • Karma: 0
Re: Building The Search Functionality
« Reply #2 on: December 29, 2014, 01:31:08 PM »
Hi Kubig,
Thanks for the quick response, can you throw some more light on this, I am using .NET for this application.

Regards,

Offline Kubig

  • Hero Member
  • *****
  • Posts: 2752
  • Karma: 44
Re: Building The Search Functionality
« Reply #3 on: December 29, 2014, 01:56:21 PM »
UCS is using Apache Lucene SW for indexing and searching. So, you can use this API (there exists a DLL for Lucene on .net platform, IWS is using it). I am using following code for querying the UCS content:
[code]RequestSearch reqSearch = new RequestSearch();
            reqSearch.IndexName = "interaction";
            reqSearch.Query = _query;[/code]where the query can be something like that:
[code]StringBuilder sb = new StringBuilder();
            sb.Append("MediaTypeId:email");
sb.AppendFormat(" AND StartDate:[{0}* TO {1}*]", FromDate, ToDate);
sb.AppendFormat(" AND EndDate:[{0}* TO {1}*]", FromDate, ToDate);
[/code]
etc.

Offline upk_singhm

  • Jr. Member
  • **
  • Posts: 88
  • Karma: 0
Re: Building The Search Functionality
« Reply #4 on: December 29, 2014, 02:20:22 PM »
Dear Kubig,
We tried using that and faced one challenge wherein we are not able to search for Business Attributes, let's say customer name or company name or ticket ID, if there's any. We are only able to search on the basis of system attributes like Email To, Email From, Subject, Date, Time. We also need to search on the basis of custom Business Attributes.

Do you have any ideas with that?

Regards,
Upkar S

Offline Kubig

  • Hero Member
  • *****
  • Posts: 2752
  • Karma: 44
Re: Building The Search Functionality
« Reply #5 on: December 29, 2014, 02:25:06 PM »
The Business Attributes should be mapped to Str/Int Attribute columns, so you are able to filter out through these columns. In general, all information which are present within UCS database can be filtered by Lucene querying.

Offline upk_singhm

  • Jr. Member
  • **
  • Posts: 88
  • Karma: 0
Re: Building The Search Functionality
« Reply #6 on: December 29, 2014, 02:33:28 PM »
Hi Kubig,
So let me get this ironed out for me, so what you are saying is, I should find the mapping of these columns to one of the Str/Int/DateTime columns and simply use the names of these columns e.g. StringAttribute1 in my query?

Is my understanding correct?

Regards,

Offline Kubig

  • Hero Member
  • *****
  • Posts: 2752
  • Karma: 44
Re: Building The Search Functionality
« Reply #7 on: December 29, 2014, 02:35:31 PM »
I suppose that you know Genesys on eServices/MCR layer and know how the mapping works. As I wrote, if can built own filter based on all information which are available within UCS database. Information which are not stored cannot be logical filtered by any application.

Offline upk_singhm

  • Jr. Member
  • **
  • Posts: 88
  • Karma: 0
Re: Building The Search Functionality
« Reply #8 on: December 29, 2014, 02:38:15 PM »
Yes, I understand the mapping for that matter. So can you let me know if my understanding which I stated in my earlier to be correct or not, I will change my queries accordingly.

Appreciate your help so far and quite a quick one at that.

Regards,

Offline Kubig

  • Hero Member
  • *****
  • Posts: 2752
  • Karma: 44
Re: Building The Search Functionality
« Reply #9 on: December 29, 2014, 02:40:36 PM »
Yes, you was partly right. You will use the column names as a filter variable, but the columns are with suffix Str or Int, nothing else (you have to know, if you know mapping mechanism :-)).

Offline upk_singhm

  • Jr. Member
  • **
  • Posts: 88
  • Karma: 0
Re: Building The Search Functionality
« Reply #10 on: December 29, 2014, 02:44:40 PM »
Yeap to be precise they are like this:
StrAttribute1, StrAttribute2 .... StrAttribute10, IntAttribute1 .... IntAttribute5.


Appreciate your help and a much needed one at this moment.

I will keep you posted as to how we finally did it, once again thanks a lot for pitching in at this point in time.

Regards,

Offline Kubig

  • Hero Member
  • *****
  • Posts: 2752
  • Karma: 44
Re: Building The Search Functionality
« Reply #11 on: December 29, 2014, 02:47:59 PM »
You are welcome. Let us know what is your final solution for this. I am not at my PC yet and cannot try it myself unfortunately.

Offline upk_singhm

  • Jr. Member
  • **
  • Posts: 88
  • Karma: 0
Re: Building The Search Functionality
« Reply #12 on: January 08, 2015, 09:25:40 PM »
Dear Kubig,
We tried running the search using the StrAttribute field which in my case is StrAttribute9 mapped to a column named "EmailAddress" and another one StrAttribute8 mapped to column name PFS_id, both have is-sortable option set to true in the CME.

I am not sure if there's something that we need to do to in the CME to make this run, but we are only able to search using the AllAttribute field for the custom data and for system fields like From, To, Subject it runs pretty smooth with no issues. But AllAttribute isn't the recommended approach we need to use the StrAttribute fields to search for custom attach data fields.

Any help in this regard is much appreciated.

Regards,

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7639
  • Karma: 56330
Re: Building The Search Functionality
« Reply #13 on: January 08, 2015, 09:31:53 PM »
Did you restart UCS? What does start up logs say about those new columns?

Offline upk_singhm

  • Jr. Member
  • **
  • Posts: 88
  • Karma: 0
Re: Building The Search Functionality
« Reply #14 on: January 14, 2015, 03:06:33 PM »
Hi cavagnaro,
I did restart UCS and here's what it says about them:
  PK_INTEGRITYREPORT on Id  IR_Composite_1 on FirstId  IR_Composite_1 on IssueId  IR_Composite_2 on IssueId  IR_Composite_2 on TenantId  IR_Composite_2 on Status  IR_Composite_3 on SecondId  IR_Composite_3 on IssueId

Interaction:
StrAttribute9 nvarchar(256) nullable:true

05:31:41.949 Dbg 29999 [Ucs-Main] Attribute com.genesyslab.icc.api.contactserver.persistent.Chat#StrAttribute9 Mapped to parent class com.genesyslab.icc.api.contactserver.persistent.Interaction
05:31:41.949 Dbg 29999 [Ucs-Main] Attribute com.genesyslab.icc.api.contactserver.persistent.Interaction#StrAttribute9 Mapped to column StrAttribute9

05:31:41.986 Dbg 29999 [Ucs-Main] Attribute com.genesyslab.icc.api.contactserver.persistent.Callback#StrAttribute9 Mapped to parent class com.genesyslab.icc.api.contactserver.persistent.Interaction

05:31:42.158 Dbg 29999 [Ucs-Main] Attribute com.genesyslab.icc.api.contactserver.persistent.EmailIn#StrAttribute9 Mapped to parent class com.genesyslab.icc.api.contactserver.persistent.Interaction

05:31:42.180 Dbg 29999 [Ucs-Main] Attribute com.genesyslab.icc.api.contactserver.persistent.EmailOut#StrAttribute9 Mapped to parent class com.genesyslab.icc.api.contactserver.persistent.Interaction

I have only shown you selective logs from the UCS.

If you want I can also send you the logs for this but you will have to tell me how to send them to you.

Let me know if you need anything specific from the logs, if the ones above aren't enough.

Hope it helps.