Armenian Knowledge Base  

Go Back   Armenian Knowledge Base > Technical sections > Webmaster Zone > Web Development
Register

Reply
 
LinkBack Thread Tools
Old 06.09.2002, 16:28   #1
Stalker
 
Timewind's Avatar
 
Join Date: 09 2002
Location: Припять
Age: 83
Posts: 853
Downloads: 0
Uploads: 0
Reputation: 12 | 3
Exclamation php and mySQL search problem!!!

People, please help!

i have mySQL server and use php
to search data in tables i use LIKE command
with % signs .....

to find strings matching 'sony' i can use
'so' or 'on' or 'so y'

but how is it possible to find srings with 'sony' and + with 'jvc', when i type 'sony jvc' ???
__________________
... for long you live and high you fly ...
Reply With Quote
Old 07.09.2002, 02:22   #2
Главный Лысый
 
Pascal's Avatar
 
Join Date: 10 2001
Location: AM
Age: 39
Posts: 2,829
Downloads: 4
Uploads: 0
Reputation: 28 | 4
Post

Tebe nuzhen poisk na site-e?


Beresh stroku poiska i explode() - ish ee po probelam ili inym razdelitelyam. posle chego podstavlyaesh poluchennie elementy massiva v sleduyushie zaprosy vmesto token1 i token2

Kak ya ponyal table vyglyadit vot tak
==
CREATE TABLE `Timewind` (`a` VARCHAR(255) NOT NULL, `b` VARCHAR(255) NOT NULL )
==
Esli tebe nado nayti 'token1' i 'token2' to primitivneyshiy nabor zaprosov vyglyadit tak

==
select a from Timewind where a like '%token1%' and a like '%token2%'
==

NAdo naiti zapis' gde est' token1 i net token2

==
select a from Timewind where a like '%token1%' and a not like '%token2%'
==

NU i tak dalee.

Pravda danniy metod ne ochen' khoroshiy, v sluchae bol'shogo kol-va zapisey.....
Gde - to na ~10000 zapisey razmera (255), ne BLOB(*TEXT v tom chisle) vremya otklika na zapros stanet nepriemlimym. Prichina - full table scan. A v sluchae s like ogranichennym procentami s obeikh storon indexy ne ispol'zuyutsya.

Ne zabud' sdelat' limit v kontse zaprosa, chtoby vyvodilis' pervye n elementov. Eto kstati mozhet znachitel'no uvelichit' skorost' otklika na bol'shoy tablitse.

Fil'truy vse simvoly otlichnye ot bukv, tsyfr i defisa.

Postav' ogranichenie na minimal'niy i maximal'niy query string.

Est' eshe neskol'ko bolee krasivykh resheniy.

Poprobuy postroit' slovar'. No mne kazhetsya eto budet slishkom slozhnym v realizacii.

Optimal'nym resheniem mozhet stat' postroenie fulltext index-a. No rabotaet eto delo normal'no tol'ko v vetke 4.0.x, a ona eshe beta. Sam etot mekhanizm vnedren gde to v 3.23.35 ili okolo togo - tochno ne pomnyu. NA sobstvennom opyte znayu, chto spokoyno mozhno ubit' server zakazav postroenie index-a na table s 1.000.000 varchar(255). Da i ne s angliyskimi kodirovkami on rabotaet ne ochen' khorosho.

Khochesh riskovat' - stav' 4.0.3 (samiy posledniy). Ne khochesh rabotay na 3.23.x.

A voobshe kupi kakuyu -to knigu po DBMS.
My favourite "An introduction to database systems" C. J. Date. Ona est' i na russkom.
__________________
Ruben Muradyan
Technical Director
PanARMENIAN Network: Armenian News

----------------------------------------------------
Лысина - это полянка, вытоптанная мыслями.
----------------------------------------------------
Reply With Quote
Reply

Thread Tools


На правах рекламы:
реклама

All times are GMT. The time now is 23:51.


Powered by vBulletin® Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.