Inconsistent results when searching via document content using API (724 Views)
Reply
Occasional Advisor
JohnUwa
Posts: 10
Registered: ‎11-18-2013
Message 1 of 19 (724 Views)

Inconsistent results when searching via document content using API

Hello

 

I'm new here so not sure if this is the right place for these type of posts.

 

Currently using the TRIM API in C# dot net to develop a search via the document content search clause but I am getting inconsistent results.

 

Using the TRIMSDK.RecordSearch object and calling the  AddDocumentContentClause to pass in the search criteria.

 

For example, if I use "attract*" as the search criteria, I get back 10 records, follow by another search with "sala*", and I get back 16 records. I then execute another search with "attract*" and this time I get back 14 records (instead of 10 and these 4 additional records seems to be from the "sala*" search)

 

These searches are executed one after the other (when the previous search has completed successfully)

 

Wonder if anyone has experienced similar issues?

 

Thanks.

Esteemed Contributor
Richard Kelly_7
Posts: 205
Registered: ‎02-15-2007
Message 2 of 19 (694 Views)

Re: Inconsistent results when searching via document content using API

Sounds like you re used the search object and left something set. Try a different search objet for each search.
Note: Any posts I make on this forum are my own personal opinion and do not constitute a formal commitment on behalf of HP.
Occasional Advisor
JohnUwa
Posts: 10
Registered: ‎11-18-2013
Message 3 of 19 (676 Views)

Re: Inconsistent results when searching via document content using API

Hello

 

Here is the code that I used, let me know what I've done wrong or if I made some silly mistakes. Thanks.

 

------------------------------------------------------------------------------------------------------------------------------

 

    private void btnSearch_Click(object sender, EventArgs e)
    {
      TRIMSDK.IDatabase newDb = new TRIMSDK.Database();

      StringBuilder resultText = new StringBuilder("");

      try
      {
        newDb.WorkgroupServerName = "ServerName";
        newDb.Id = "BDID";
        newDb.WebServerWorkPath = "C:\\Temp";

        newDb.SetAsService();
        newDb.Connect();

        TRIMSDK.RecordSearch objSearch = newDb.NewRecordSearch();

        objSearch.AddDocumentContentClause(txtContentSearch.Text.ToString());
        objSearch.AddUserFieldClause(newDb.GetFieldDefinition("Approved?"), true, null);
        objSearch.And();

        objSearch.FilterRecordType(newDb.GetRecordType("Special Policies"), true);

        TRIMSDK.Records returnRecords = objSearch.GetRecords();

        resultText.Append("Search String : " + (returnRecords as TRIMSDK.RecordsClass).Title + "\r\n");
        resultText.Append("Total Records : " + (returnRecords as TRIMSDK.RecordsClass).Count.ToString() + "\r\n");

        TRIMSDK.Record returnRecord = returnRecords.Next();

        while (returnRecord != null)
        {
          resultText.Append("ID : " + returnRecord.Number + "\r\n");
          resultText.Append("Title : " + returnRecord.Title + "\r\n");

          returnRecord = returnRecords.Next();
        }

        resultText.Append(" \r\n");
        resultText.Append("--------------------------------------------------------\r\n");
        resultText.Append(" \r\n");

        objSearch = null;
        returnRecords = null;

        txtResult.Text = resultText.ToString();
      }
      finally
      {
        if (newDb.IsConnected)
        {
          newDb.Disconnect();
        }

        System.Runtime.InteropServices.Marshal.ReleaseComObject(newDb);

        newDb = null;
      }
    }

Esteemed Contributor
Richard Kelly_7
Posts: 205
Registered: ‎02-15-2007
Message 4 of 19 (661 Views)

Re: Inconsistent results when searching via document content using API

Other than a ReleaseComObject (objSearch) and on returnRecords that I would include, I am struggling to see the problem, as each search is a separate database and record search object.

 

Note: Any posts I make on this forum are my own personal opinion and do not constitute a formal commitment on behalf of HP.
Occasional Advisor
JohnUwa
Posts: 10
Registered: ‎11-18-2013
Message 5 of 19 (650 Views)

Re: Inconsistent results when searching via document content using API

Hello

 

I have added these following lines of code but issue remains.

 

System.Runtime.InteropServices.Marshal.ReleaseComObject(objSearch);
objSearch = null;

System.Runtime.InteropServices.Marshal.ReleaseComObject(returnRecords);
returnRecords = null;

 

I have however made an observation, if I ran the search queries straight away, one after the other, the issue persists. However if I wait for 1 minute between the queries, issue did not appear (behaving as per normal).

 

Weird.....

Honored Contributor
EWillsey
Posts: 1,929
Registered: ‎04-20-2010
Message 6 of 19 (643 Views)

Re: Inconsistent results when searching via document content using API

Are you using Oracle as the back-end database?
Occasional Advisor
JohnUwa
Posts: 10
Registered: ‎11-18-2013
Message 7 of 19 (641 Views)

Re: Inconsistent results when searching via document content using API

Yes, oracle is the back-end database.
Honored Contributor
EWillsey
Posts: 1,929
Registered: ‎04-20-2010
Message 8 of 19 (637 Views)

Re: Inconsistent results when searching via document content using API

Ahh. There were a few builds in 7.1 I think where the temporary table used to join the content index to the records wasn't being purged. Which build are you on?
Occasional Advisor
JohnUwa
Posts: 10
Registered: ‎11-18-2013
Message 9 of 19 (630 Views)

Re: Inconsistent results when searching via document content using API

Ok, Not sure if I am reading this correctly but this is what I see from the HP TRIM Setup Information.
Version 7
Build 1.0.1157
Internal Code 63244

Does this help?

If it's possible, could you explain what you meant by temporary table used to join the content index to records wasn't being purged? Is this a "feature" or "Bug" or something that I could "control" or change in HP TRIM or the oracle database?

Thanks for your help.
Honored Contributor
EWillsey
Posts: 1,929
Registered: ‎04-20-2010
Message 10 of 19 (626 Views)

Re: Inconsistent results when searching via document content using API

It's a bug.  When you execute a document content search, TRIM will "shell out" a query to the index.  The index returns a set of URIs which related to the TSRECORD table.  TRIM will store those URIs in a temporary table and join that across to the TSRECORD table.  The problem with Oracle was that those temporary tables weren't being purged routinely (and were lingering around longer than desirable).  Since this is all done by the workgroup server you can't just use a newer version of the SDK.  

 

This was marked as fixed in 7.1.0.1150.  You should check the build on the server to see that it matches.

 

I'm really guessing here, but I've heard of this before and know it was later fixed.  

 

If the server is on the correct build (1150+) then I would suggest you double-check that your Oracle Client Drivers match the exact build of your oracle server.  Meaning, if your Oracle server is 10.0.2.2 then the client drivers installed on TRIM must also be 10.0.2.2.  It is a common thing that IT will install newer (or even older) client tools.  Make sure they match.

 

Outside of that maybe submit a support ticket to HP.

Occasional Advisor
JohnUwa
Posts: 10
Registered: ‎11-18-2013
Message 11 of 19 (620 Views)

Re: Inconsistent results when searching via document content using API

Thanks for the explaination, and yes, I roughly understood what was going on with the document content search with the logs from TRIM but wasn't 100% sure. This just re-enforce my understand. :)

I shall check with our DBAs on the server build for TRIM (making sure it's 1150+) Is there anywhere in HP site that I could view this "fix" as marked in 7.1.0.1150?

Another question, if the Oracle server is 10.0.2.2, does it matter if our client drivers are newer (like 10.0.3 or something)?

Thanks for all the help, I shall chase down these few other details to investigate.
Honored Contributor
EWillsey
Posts: 1,929
Registered: ‎04-20-2010
Message 12 of 19 (616 Views)

Re: Inconsistent results when searching via document content using API

If you're using Oracle and you're having weird issues with TRIM, a lot of times the culprit is using a driver build other than the one matching the server.  Best practice is to make sure they match.

 

The fix is listed in the SPER report for build 1150.

Occasional Advisor
JohnUwa
Posts: 10
Registered: ‎11-18-2013
Message 13 of 19 (614 Views)

Re: Inconsistent results when searching via document content using API

Thanks, just wondering if this is the fix that you are referring to
http://www.trimuser.com/wp-content/uploads/2011/09/TRIM7.1_Fixes.htm

Fix 41528
Honored Contributor
EWillsey
Posts: 1,929
Registered: ‎04-20-2010
Message 14 of 19 (611 Views)

Re: Inconsistent results when searching via document content using API

Right document, but number 34017

Occasional Advisor
JohnUwa
Posts: 10
Registered: ‎11-18-2013
Message 15 of 19 (606 Views)

Re: Inconsistent results when searching via document content using API

Thanks, was looking at list for build 1150. This fix 34017 was in build 1132 (interesting)... :)
Honored Contributor
EWillsey
Posts: 1,929
Registered: ‎04-20-2010
Message 16 of 19 (604 Views)

Re: Inconsistent results when searching via document content using API

Well it may not be the exact culprit. Though sounds like the problem! Either one could be right :)
Occasional Advisor
JohnUwa
Posts: 10
Registered: ‎11-18-2013
Message 17 of 19 (596 Views)

Re: Inconsistent results when searching via document content using API

Ok, just check with our DBAs and had a look with our eyes, the Oracle client is 11.2.0.2.0 and it's the same version as the Oracle database (backend).

So I guess I might have to open a case with HP for further investigation....unless there is something else I could investigate.

Thanks again.
Honored Contributor
EWillsey
Posts: 1,929
Registered: ‎04-20-2010
Message 18 of 19 (593 Views)

Re: Inconsistent results when searching via document content using API

Did you check the build of the server? You can get to that by either opening the client or TES on the server... Or just check the properties of the TRIM.exe
Occasional Advisor
JohnUwa
Posts: 10
Registered: ‎11-18-2013
Message 19 of 19 (589 Views)

Re: Inconsistent results when searching via document content using API

Yes I did, forgot to update. Check the version of a few exe files, like TRIMDCI.exe and TRIM.exe and they have the same version number, 7.1.0.1157
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.