Software Design
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreSoftware Design

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 1st, 2002, 04:36 AM
how-do-i how-do-i is offline
aooooooodaaa
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2001
Location: at a pc near you
Posts: 32 how-do-i User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Question perform partial search

hello,

I'm trying to make a search engine which should report partial results as well... for instance if "alpha" is present in the database then searching "alfa" should report "alpha" in the partial match result..

I do realise that a search of this type will take longer, i'm fixing that with two searches... exact and exact+partial. Also i believe that lots of language considerations will need to be made i.e. the phonetics for "ph", "f" are the same.

a bit off the topic, whats the way to search for a substring inside mysql db.. for instance if the entry is "the new end of the world news" how do i search for all occurances of "new".
The problems i faced were that the wildcard % does not include eof or beginning of file.. so for "new new new" n searching for "%new%" would result in only one occurance.. i.e. for the middle. any ways around this? other than adding more conditions like "%new" << for end and "new%" for beginning


thanks a lot
__________________
it's electric baaaabbbbbbyyyyyy!!!

Reply With Quote
  #2  
Old April 1st, 2002, 08:31 AM
andnaess andnaess is offline
Contributing User
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Jul 2001
Location: Oslo
Posts: 1,516 andnaess User rank is Private First Class (20 - 50 Reputation Level)andnaess User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
I guess your best bet is the SOUNDEX function...

I think you've misunderstood how wildcards work. '%new%' will match 'new thing', 'I am new here' and 'this is new'. % means zero or more occurences.
__________________
--
Regards
André Næss

Puritanism: The haunting fear that someone, somewhere may be having fun

Reply With Quote
  #3  
Old April 9th, 2002, 10:16 PM
The Ostrich The Ostrich is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Location: Oxford, UK
Posts: 31 The Ostrich User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
If you write a parser that allows wildcards between strings, then you can get the desired result:

"al*a" matches "alpha".

The problem then reduces to figuring out which partial matches to look for - because almost everything in the target file is likely to be a partial match to some non-empty substring or combination of substrings of the search string. I agree that the best way to do what you want is to just use the soundex function, and do exact matching (or slightly fuzzy matching) with it - but this only applies if you are searching for linguistic matches to poorly spelled sources. If it is a more general problem, then the solution is far from obvious.

Reply With Quote
  #4  
Old April 11th, 2002, 02:31 AM
how-do-i how-do-i is offline
aooooooodaaa
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2001
Location: at a pc near you
Posts: 32 how-do-i User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
the % thing doesn't work!!!

hello,
i tried using "%therapy%" and it returns nothing... !! although the string i'm searching for in the databse is "therapy dogs in the house" result is returned though when i my search is "therapy %"!!! weird?? anyways.. thanks a lot..i'll look into the soundex function :smile:

Reply With Quote
  #5  
Old April 20th, 2002, 08:49 AM
Bigfoot Bigfoot is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Posts: 2 Bigfoot User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Artificial Intelligence would be handy with this problem. Anyone have a script for that?

Reply With Quote
  #6  
Old April 26th, 2002, 03:22 AM
Thrasher Thrasher is offline
Canta como rafaé
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Location: Barcelona
Posts: 74 Thrasher User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to Thrasher
The % wildcard never returns a number, it returns true or false. So, you cannot achieve the behaviour you want in the database unless you use some other functions or procedures.

Most databases have some regular expression functions, ie RLIKE in mySQL. Look at them.

Soundex is a good solution for english, but take this as an advice. Keep in the database tables the soundex of the fields you are looking for, avoiding soundex encoding foreach query you do. Faster.
__________________
Thrasher



'Y se ahogaron los dooos
No eran duros pa pagar, cuñaaoo !!'
El vagamundo - El risitas y su cuñao

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreSoftware Design > perform partial search


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT