Fulltext search in dbf inclusive Memo fields

Fulltext search in dbf inclusive Memo fields

Postby Otto » Sun Jul 21, 2013 7:10 am

Hello,
does someone have some code how to search inside a dbf file inclusive Memo fields.
Thanks in advance
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Re: Fulltext search in dbf inclusive Memo fields

Postby Antonio Linares » Sun Jul 21, 2013 7:45 am

Otto,

you were using this one:
viewtopic.php?p=80148#p80148

and now want to search in memos too, right ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42093
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Fulltext search in dbf inclusive Memo fields

Postby Otto » Sun Jul 21, 2013 8:45 am

Hello Antonio,
thank you for your attention. Yes that is what I want to do. I would like to insert also the content of the memo fields in my search function.
Thanks in advance
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Re: Fulltext search in dbf inclusive Memo fields

Postby Antonio Linares » Sun Jul 21, 2013 6:21 pm

Otto,

What file extension do you have in your memo files ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42093
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Fulltext search in dbf inclusive Memo fields

Postby Antonio Linares » Sun Jul 21, 2013 6:26 pm

Otto,

Please email me a DBF with a memo file of yours, thanks :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42093
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Fulltext search in dbf inclusive Memo fields

Postby Antonio Linares » Sun Jul 21, 2013 9:45 pm

Otto,

I think the way to do it is to perform a free search inside the FPT file for a string. If found, we have its position inside the file. Then we have to read the DBF record by record starting from the bottom of the DBF and going backwards to the first one (we can do it directly, without using the RDD) as in each record is kept the position of each memo inside the FPT file. Basically:

in pseudo code:
Code: Select all  Expand view

local nOffset := At( "string", MemoRead( "myfile.fpt" ) )

if nOffset != 0
   We read the DBF, record by record, starting from the end of the DBF
      while RecordMemoOffset() > nOffset .and. nPosInDbf > 0
          GoPrevRecord()
      end
      if nPosInDbf > 0
         MsgInfo( "found" )
      endif
endif
 
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42093
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Fulltext search in dbf inclusive Memo fields

Postby Antonio Linares » Sun Jul 21, 2013 10:04 pm

Otto,

Using FiveDBU I open your DBF and edit the closest field to the memo field:
Image

Now, I review the DBF in binary mode and look for my modified value:
Image

I would say that 44FF is the offset of its memo inside the FPT file. Using Header() and RecSize(), get the position of 44FF, and it should be the same for each record.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42093
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Fulltext search in dbf inclusive Memo fields

Postby Antonio Linares » Sun Jul 21, 2013 10:15 pm

44 :-)

can't be 44FF
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42093
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: karinha, nageswaragunupudi and 102 guests