FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Full text Search
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Full text Search
Posted: Tue Jan 30, 2007 06:46 PM

How could I manage a full text search in the whole database like LOCATE but in all fields?
Regards
Otto

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Full text Search
Posted: Tue Jan 30, 2007 06:52 PM

Otto,

At( cText, MemoRead( "file.dbf" ) )

once found, substract the DBF header size, and divide it by the record size

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Full text Search
Posted: Tue Jan 30, 2007 07:33 PM

Thank you. I there a limit for memoread: FW FWH

Regards
Otto

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Full text Search
Posted: Tue Jan 30, 2007 10:01 PM

Otto,

MemoRead() is a Harbour function. There is no size limit (max. 4 gigs)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM
Full text Search
Posted: Tue Jan 30, 2007 11:34 PM

If you have xHarbour from .com then you can use FTS (Full Text Search) to create index and search.

Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Full text Search
Posted: Wed Jul 18, 2007 05:07 AM
Antonio Linares wrote:
At( cText, MemoRead( "file.dbf" ) )

once found, substract the DBF header size, and divide it by the record size


This is a neat trick! What further modification need to be done to take into account contents of memo fields also?
FWH 11.08/FWH 19.12

BCC5.82/BCC7.3

xHarbour/Harbour
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Full text Search
Posted: Wed Jul 18, 2007 06:38 AM

memo fields require a different approach as they are not stored in the DBF, but on an external file. You can search in such external file, and then you should search its offset into the DBF.

You may ask Przemek how to get the memo offset from the DBF

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 824
Joined: Thu Oct 13, 2005 07:39 AM
Re: Full text Search
Posted: Wed Jul 18, 2007 07:58 AM
Otto,

Otto wrote:How could I manage a full text search in the whole database like LOCATE but in all fields?
Regards
Otto


you can try the Hiper-Seek functions of xHarbour. That´s a very fast seek over all fields in dbf. But I don´t know, if it supports memo too.

Here is an example:




#INCLUDE "Fivewin.ch"
#include "dbinfo.ch"

//REQUEST RMDBFCDX
REQUEST DBFCDX
//REQUEST BMDBFCDX

PROCEDURE Main()
   FIELD FIRST, LAST, STREET, CITY
   LOCAL n, hs

   rddSetDefault( "DBFCDX" )
//   rddSetDefault( "BMDBFCDX" )
//   if ascan( rddList(1), "RMDBFCDX" ) != 0
//      rddSetDefault( "RMDBFCDX" )
//   endif
//   ? RddSetDefault ()
   use test
   hs := HS_INDEX( "test", "FIRST+LAST+STREET+CITY", 2, 0, , .T., 3 )

   /* Look for all records which have 'SHERMAN' string inside */
   HS_SET( hs, "SHERMAN" )
   while ( n := HS_NEXT( hs ) ) > 0
      dbgoto( n )
      if HS_VERIFY( hs ) > 0
         ? rtrim( FIRST+LAST+STREET+CITY )
      endif
   enddo
//   wait

   /* Does RDD support Record Map Filters? */
//   if dbinfo( DBI_RM_SUPPORTED )
      /* if yest then let set filter for all records with 'SHERMAN'
         word and look at them in browser */
      HS_FILTER( hs, "SHERMAN" )
      DbSetFilter( {|| "SHERMAN"},  "SHERMAN" )
      dbgotop()
      browse()
//   endif

   HS_CLOSE( hs )
   CLOSE ALL
   QUIT

RETURN
kind regards

Stefan
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Memoread
Posted: Thu Jun 26, 2008 08:36 PM
Hello Antonio,

I would like to use your solution.
But now I face the problem that some dbf files only return 4 or 5 bytes.
If I try to open the clients.dbf form the Fivewin sample this is the result:

local cText := MemoRead( "clientes.dbf" )

msginfo(ctext )





Otto,

At( cText, MemoRead( "file.dbf" ) )

once found, substract the DBF header size, and divide it by the record size
_________________
regards, saludos

Antonio Linares
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Full text Search
Posted: Thu Jun 26, 2008 08:54 PM

Otto,

You can't see it as it has embedded zeroes. Try this:

MsgInfo( Len( ctext ) )

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Full text Search
Posted: Thu Jun 26, 2008 09:12 PM

Thank you Antonio.

Posts: 233
Joined: Sat Dec 30, 2006 06:10 AM
Full text Search
Posted: Wed Nov 26, 2008 12:04 PM

Hi Stefan,

I get a "Unresolved External _HB_FUN_HS_INDEX" error when I try to compile your test. According to the help file I need - xhb.lib - is that correct? I can't find that lib on my PC, and yet I have xHarbour? Any ideas as to what I am doing wrong?

Did you ever find out if the Hyperseek works on MEMO fields too?

Antonio, do you know how to get the memo offset from the DBF if I use your method? (in case Hyperseek doesn't work for MEMOs)

Many thanks

Ollie.



Using:

xHarbour Compiler build 1.2.1 (SimpLex) (Rev. 6406)

Borland C++ 5.5.1

FWH 9.04 (2009 Apr)
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Full text Search
Posted: Wed Nov 26, 2008 02:11 PM

Ollie,

> Antonio, do you know how to get the memo offset from the DBF

What RDD are you using ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 233
Joined: Sat Dec 30, 2006 06:10 AM
Full text Search
Posted: Wed Nov 26, 2008 02:15 PM

DBFCDX

Many thanks

Ollie.



Using:

xHarbour Compiler build 1.2.1 (SimpLex) (Rev. 6406)

Borland C++ 5.5.1

FWH 9.04 (2009 Apr)
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Full text Search
Posted: Wed Nov 26, 2008 02:29 PM

Ollie,

I guess that you could use:

DbInfo( DBI_BLOB_OFFSET )

http://www.ousob.com/ng/53guide/ng28fbc.php

and/or

DbFieldInfo( DBS_BLOB_OFFSET )

http://www.ousob.com/ng/53guide/ng25343.php

regards, saludos

Antonio Linares
www.fivetechsoft.com