Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi Stream (https://www.delphipraxis.net/93453-stream.html)

mohfa 6. Jun 2007 08:04


Stream
 
I use MxStorage to store my Files , is there a way to search for a keyword in these stored Files without extract them at all , Then if the result is positive we give the File Name where the Keyword is found.

I thought of using a Stream ( TMemorySteam ).


Thanks in advance

Phoenix 6. Jun 2007 08:20

Re: Stream
 
I would keep a seperate hashtable with the keywords and the specific filenames. Searching in a well sorted hashtable is a lot faster than running around in a stream, because you would have to scan the whole stream (worst case) to find the keyword - in the (sorted) hashtable you only have to match up the hash value, and you can do that character for character, so when you have the hash abcdef and you start at the beginning and find baaaaa in the list you know that you don't have to look further because there won't be another hash starting with an a later on.

mohfa 6. Jun 2007 08:26

Re: Stream
 
Thanks Phoenix , could you please provide me with an exemple .

Phoenix 6. Jun 2007 08:34

Re: Stream
 
Huh, that was more a theoretical point of view ;-)

But I think there are good 'THashTable' implementations somewhere out there you can use.

Have a look here: http://www.vclcomponents.com/catalog/Hash_Table
and here: http://www.benya.com/code/collections/hashtable.html

I think a search for Bei Google suchenHashTable Delphi or a search here in the DP for Hier im Forum suchenHashtable will bring you good additional information.


Alle Zeitangaben in WEZ +1. Es ist jetzt 11:58 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz