Building The Search Functionality

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,

You can use Apache Lucene for these purposes. All records are indexed by this software.

Hi Kubig,
Thanks for the quick response, can you throw some more light on this, I am using .NET for this application.

Regards,

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:

RequestSearch reqSearch = new RequestSearch();
            reqSearch.IndexName = "interaction";
            reqSearch.Query = _query;

where the query can be something like that:

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);

etc.

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

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.

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,

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.

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,

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 :-)).

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,

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.

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,

Did you restart UCS? What does start up logs say about those new columns?

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.

Send export of database table for metadata (relation between columns and KVP) from UCS database.

This function works ok and without any errors, except errors within deployment or post-configuration.

Here it is,
I am not sure if it is readable enough. If not let me know I will try and provide in another format or better yet let me know how to send an attachment.

Id,TheName,DisplayName,TheType,TenantId,Active,ModifiedDate,Format,IsSortable,MappingColumnName

00001a5GBQR4002F,Priority,Priority,0,1,1,2009-11-20 00:12:55.483,0,NULL
00001a5GBQR4002G,ReasonCode,Reason Code,0,1,1,2009-11-20 00:12:55.483,0,NULL
00001a5GBQR4002H,Category,Category,0,1,1,2009-11-20 00:12:55.483,0,NULL
00001a5GBQR4002J,InteractionType,Interaction Type,0,1,1,2009-11-20 00:12:55.483,0,NULL
00001a5GBQR4002K,MediaType,Media Type,0,1,1,2009-11-20 00:12:55.483,0,NULL
00001a5GBQR4002M,Language,Language,0,1,1,2009-11-20 00:12:55.483,0,NULL
00001a5GBQR4002N,StopProcessingReason,StopProcessing Reason,0,1,1,2009-11-20 00:12:55.500,0,NULL
00001a5GBQR4002P,InteractionSubtype,Interaction Subtype,0,1,1,2009-11-20 00:12:55.500,0,NULL
00001a5GBQR4002Q,ServiceType,Service Type,0,1,1,2009-11-20 00:12:55.500,0,NULL
00001a5GBQR4002R,DispositionCode,Disposition Code,0,1,1,2009-11-20 00:12:55.500,0,NULL
00043a67DR2M10UE,survey_answer_Overall,Survey Overall,0,1,1,2010-09-07 18:08:35.777,1,StrAttribute3
00043a67DR2M10UU,survey_answer_ByAgent,Survey by Agent,0,1,1,2010-09-07 18:07:35.650,1,StrAttribute2
00043a67DR2M10V8,survey_answer_Recommend,Survey Recommend,0,1,1,2010-08-31 01:21:09.047,1,StrAttribute1
0006Da6R2VRS000W,FacebookCommentId,FacebookCommentId,0,1,1,2011-03-17 02:34:05.887,1,StrAttribute4
0006Da6R2VRS000X,FacebookOutboundCommentId,FacebookOutboundCommentId,0,1,1,2011-03-17 02:34:05.887,1,StrAttribute5
0006Da6R2VRS000Y,TwitterMsgId,TwitterMsgId,0,1,1,2011-03-17 02:34:05.887,1,StrAttribute6
0006Da6R2VRS0010,FacebookPostId,FacebookPostId,0,1,1,2011-03-17 02:34:05.903,1,StrAttribute7
000FWaAA2HWA000K,PFS_id,PFS ID,0,1,1,2015-01-05 11:48:19.607,1,StrAttribute8
000FYaAAT1N1000K,EmailAddress,E-mail Address,0,1,1,2015-01-07 12:59:02.173,1,StrAttribute9
000G0aAAVKNC000K,StrAttribute8,PFS ID Str,0,1,0,2015-01-08 20:32:07.327,0,NULL

Thanks for the help.

Hi Cavagnaro/Kubig,
I am trying to search on StrAttribute9 which is mapped to EmailAddress

Id,TheName,DisplayName,TheType,TenantId,Active,ModifiedDate,Format,IsSortable,MappingColumnName

000FYaAAT1N1000K,EmailAddress,E-mail Address,0,1,1,2015-01-07 12:59:02.173,,1,StrAttribute9

Hope it helps.

Thanks

And if you add the parameter StrAttribute9 to the where condition, what is the result?

Hi Kubig,
Here’s the query and the result:

SELECT *
FROM IxnAttributeMetaData
Where MappingColumnName = ‘StrAttribute9’

Id,TheName,DisplayName,TheType,TenantId,Active,ModifiedDate,Format,IsSortable,MappingColumnName

000FYaAAT1N1000K,EmailAddress,E-mail Address,0,1,1,2015-01-07 12:59:02.173,0,1,StrAttribute9

Let me know if it helps.