NetTalk Central

Author Topic: Problem on search keywords  (Read 4617 times)

Robert Iliuta

  • Sr. Member
  • ****
  • Posts: 471
    • View Profile
    • Email
Problem on search keywords
« on: January 03, 2011, 01:11:59 AM »
Hallo,


I need to implement an advanced search in my project. I have a column where I put keywords for data base. Now I want to search in that column.
The problem is this:
My keyword is: robert iliuta
1) If I search robert iliuta it will found the record.
2) If I search iliuta robert it will NOT found the record.

Now this is a problem because NT will try to find in the exact order they have been write and he will take this words like 1 word. You will never find that record if you will not write in the correct order....
Is there another way to search ?
They want to search by multiple words not just a single word...

Thank you for any suggestions,
Robert Iliuta

C6 9058 / NT5.09

Gordon Holfelder

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
    • Email
Re: Problem on search keywords
« Reply #1 on: January 03, 2011, 03:36:10 PM »
Hello Robert-

Is this a SQL database? If so, you will have to frame your search using the LIKE verb. For example a filter:

SQL(table.[Keywords] LIKE '%iliuta%' OR table.[keywords] LIKE '%robert%')

would find any row that has either iluta or robert. This would also find roberta, robertb, etc. so you may need to do a bit of formatting to get what you are looking for.

Regards,
Gordon

Robert Iliuta

  • Sr. Member
  • ****
  • Posts: 471
    • View Profile
    • Email
Re: Problem on search keywords
« Reply #2 on: January 04, 2011, 12:10:52 AM »
Hallo Gordon,


Thanks for reply. It's TPS data base.
What can I do here?

Thank you,
Robert

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Problem on search keywords
« Reply #3 on: January 04, 2011, 04:25:04 AM »
Use INSTRING

The problem with either method is you need to parse your search parameter by spaces and use this to build the filter.

eg You might want to search on  TOM DICK HARRY

Robert Iliuta

  • Sr. Member
  • ****
  • Posts: 471
    • View Profile
    • Email
Re: Problem on search keywords
« Reply #4 on: January 04, 2011, 05:18:45 AM »
Hallo Kevin,

Do you have an example? or some steps how to do that?

Thnak you,
Robert

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Problem on search keywords
« Reply #5 on: January 04, 2011, 01:50:23 PM »
Something like this although there are ways to make much more efficient (see clarion mag):

Len# = Len(Clip(L:AdvSearch))
Pos# = 1
Loop I# = 1 to Len#
  If L:AdvSearch[I#] = <32>!the ascii value = space
    !Use substring to add the value to a Q
    Pos# = I#
  End
End
!Use substring again to find last keyword and add the value to a Q

Loop thu your Q to build the filter.

I think Bruce's String Theory Class will do the above with one line of code and generate the Q to loop through.

HTH's

Kev
« Last Edit: January 04, 2011, 01:59:44 PM by kevin plummer »

Robert Iliuta

  • Sr. Member
  • ****
  • Posts: 471
    • View Profile
    • Email
Re: Problem on search keywords
« Reply #6 on: January 06, 2011, 12:47:49 AM »
Thank you Kevin,

I will try this way.
Hope that NT5 will have this future integrated.

Robert

terryd

  • Hero Member
  • *****
  • Posts: 759
    • View Profile
    • Davcomm
    • Email
Re: Problem on search keywords
« Reply #7 on: January 06, 2011, 09:08:20 PM »
Robert
Possibly a quicker search function would be to create a keywords table storing each keyword separately with a link to the document that that keywork relates to
i.e.
document1
|_ keyword1
|_ keyword2

document2
|_Keyword3
|_Keyword4
|_etc.
.
Then when they query robert iliuta or iliuta robert you could create entry fields for each keyword

You then have a choice of creating an OR filter (display all documents where the keyword robert OR iliuta appears)
or an AND filter (display all documents where both the keywords robert AND Iliuta appear)
This would be a much faster search capability than looping through all documents every time you do a search. It also allows you to have as many keywords per document as you want, no restriction based on field size.
In my system I have a field where the client can enter a 1k string describing the document. I then parse this in a similar fashion to that described by Kevin and I write all of the words to my keywords file.
I also create an exception file where I can add keywords that I don't want to be keywords.
e.g. If the client enters 'This document is about my contract with Smith Brothers'
I would have the words: 'this is about my with' in my exceptions file and the words: 'document contract Smith Brothers' would be in my keywords file
So any combination of the keywords would find the document.
Terry Davidson
Windows 10 64 bit/Windows7 64bit
Clarion 9.1.11529/Clarion10 12567
Nettalk 913
Nettalk 1015
StringTheory267/Winevent515/XFiles298/MessageBox239/Cryptonite186

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11181
    • View Profile
Re: Problem on search keywords
« Reply #8 on: January 07, 2011, 03:50:31 AM »
>> Hope that NT5 will have this future integrated.

Search is not a trivial problem - consider that Google makes billions from it for example. So I'm not sure how far down this road I'll go "inside" the product.

SQL certainly has search features that probably make that the first step if search is required.

cheers
Bruce

Robert Iliuta

  • Sr. Member
  • ****
  • Posts: 471
    • View Profile
    • Email
Re: Problem on search keywords
« Reply #9 on: January 07, 2011, 05:02:23 AM »
Bruce, I don't understand you on this...

Robert

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11181
    • View Profile
Re: Problem on search keywords
« Reply #10 on: January 07, 2011, 10:17:24 PM »
which part?

Robert Iliuta

  • Sr. Member
  • ****
  • Posts: 471
    • View Profile
    • Email
Re: Problem on search keywords
« Reply #11 on: January 09, 2011, 04:53:22 AM »
this:
"Search is not a trivial problem - consider that Google makes billions from it for example. So I'm not sure how far down this road I'll go "inside" the product."

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11181
    • View Profile
Re: Problem on search keywords
« Reply #12 on: January 09, 2011, 08:01:58 PM »
sorry, I was commenting on your line
>> Hope that NT5 will have this future integrated.

to which I say;
"So I'm not sure how far down this road I'll go "inside" the product."

Cheers
Bruce

Robert Iliuta

  • Sr. Member
  • ****
  • Posts: 471
    • View Profile
    • Email
Re: Problem on search keywords
« Reply #13 on: January 10, 2011, 12:05:37 AM »
sorry, I was commenting on your line
>> Hope that NT5 will have this future integrated.
It was something wrong?

to which I say;
"So I'm not sure how far down this road I'll go "inside" the product."
Yes

Robert