MySQL Forums
Forum List  »  Full-Text Search

Re: How to search based on first LETTER of consecutive words
Posted by: rubs sin
Date: April 28, 2013 11:42AM

Thanks, works fine for English but It is not working fine for Unicode(UTF-8) if we consider following rows in the table:

CREATE TABLE testfulltext (
id int(11) NOT NULL,
Scripture text,
ScriptureEnglish text,
PRIMARY KEY (id),
FULLTEXT KEY Scripture (Scripture),
FULLTEXT KEY ScriptureEnglish (ScriptureEnglish)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

--
-- Dumping data for table `testfulltext`
--

INSERT INTO testfulltext VALUES (1, 'ਗੁਰਾਂ ਦੀ ਦਇਆ ਦੁਆਰਾ, ਤੂੰ ਮੈਂ ਕਮੀਣ ਨੂੰ ਵਡਿਆਇਆ ਹੈ', 'By Guru''s grace, Thou hast honoured me, the menial.');
INSERT INTO testfulltext VALUES (2, 'ਤਖਤੇ ਖੋਲ੍ਹ ਕੇ ਤੂੰ ਮੈਨੂੰ ਆਪਣੀ ਹਜੂਰੀ ਵਿੱਚ ਸੱਦਿਆ ਹੈ,', 'Opening the shutters, thou has summoned me to thine presence,');
INSERT INTO testfulltext VALUES (3, 'ਗੁਰੂ ਜੀ ਫਰਮਾਉਂਦੇ ਹਨ, ਸਾਰਾ ਪਰਦਾ ਪਾਟ ਗਿਆ ਹੈ,', 'Says Nanak, the entire screen is torn away,');
INSERT INTO testfulltext VALUES (4, 'ਸੱਚੇ ਗੁਰਾਂ ਦੀ ਦਇਆ ਦੁਆਰਾ ਬੈਕੁੰਠੀ ਕੀਰਤਨ ਮੇਰੇ ਹਿਰਦੇ ਅੰਦਰ ਗੂੰਜਦਾ ਹੈ। ਠਹਿਰਾਓ।', 'By the True Guru''s grace, celestial strain resounds within my mind. Pause.');
INSERT INTO testfulltext VALUES (5, 'ਮੰਗਤਾ, ਮਾਲਕ ਦੇ ਬੂਹੇ ਉੱਤੇ, ਟਹਿਲ ਸੇਵਾ ਕਮਾਉਂਦਾ ਹੈ ਅਤੇ ਮਾਲਕ ਦੇ ਦਰਬਾਰ ਅੰਦਰ ਉਹ ਉਸ ਦੀ ਮਹਿਮਾ ਗਾਇਨ ਕਰਦਾ ਹੈ।', 'The mumper performs service at the Lord''s door and in the Lord''s court, he hymns His praise.');
INSERT INTO testfulltext VALUES (6, 'ਜੋ ਸੱਚੇ ਸੁਆਮੀ ਨੂੰ ਚੰਗਾ ਲਗਦਾ ਹੈ, ਉਸ ਨੂੰ ਉਹ ਪ੍ਰਭਤਾ ਪ੍ਰਦਾਨ ਕਰਦਾ ਹੈ;', 'He, who is pleasing to the True Lord; him He blesses with glory;');
INSERT INTO testfulltext VALUES (7, 'ਕੋਈ ਵਿਰਲਾ ਪੁਰਸ਼ ਹੀ ਗੁਰਾਂ ਦੀ ਦਇਆ ਦੁਆਰਾ ਇਸ ਨੂੰ ਅਨੁਭਵ ਕਰਦਾ ਅਤੇ ਸੋਚਦਾ ਵੀਚਾਰਦਾ ਹੈ।', 'Rare is the person who realises and reflects on it, by the Guru''s grace.');
INSERT INTO testfulltext VALUES (8, 'ਘਣੇਰਿਆਂ ਪਾਪਾਂ ਅੰਦਰ ਇਹ ਸੜ ਸੜ ਕੇ ਤਬਾਹ ਹੁੰਦਾ ਹੈ।', 'In many sins, if burns, burns and is wasted away.');
INSERT INTO testfulltext VALUES (9, 'ਗੁਰਾਂ ਦੇ ਰਾਹੀਂ ਜੇਕਰ ਬੰਦਾ ਪ੍ਰਭੂ ਨੂੰ ਸਮਝ ਲਵੇ, ਤਦ ਉਹ ਸੁਆਮੀ ਦੇ ਬੂਹੇ ਨੂੰ ਵੇਖ ਲੈਂਦਾ ਹੈ।', 'Through the Guru, if one understands the Lord, then sees he the Lord''s door.');
INSERT INTO testfulltext VALUES (10, 'ਗੁਰਾਂ ਦੇ ਰਾਹੀਂ ਬੰਦਾ ਪ੍ਰਭੂ ਨੂੰ ਸਮਝ ਲਵੇ, ਤਦ ਉਹ ਸੁਆਮੀ ਦੇ ਬੂਹੇ ਨੂੰ ਵੇਖ ਲੈਂਦਾ ਹੈ।', 'Through the Guru, one understands the Lord, then sees he the Lord''s door.');
INSERT INTO testfulltext VALUES (11, 'ਪ੍ਰਭੂ ਨੂੰ ਸਮਝ ਲਵੇ, ਤਦ ਉਹ ਸੁਆਮੀ ਦੇ ਬੂਹੇ ਨੂੰ ਵੇਖ ਲੈਂਦਾ ਹੈ।', 'one understands the Lord, then sees he the Lord''s door.');
INSERT INTO testfulltext VALUES (12, 'ਗੁਰਾਂ ਦੀ ਦਇਆ ਦੁਆਰਾ, ਤੂੰ ਮੈਂ ਕਮੀਣ ਨੂੰ ਵਡਿਆਇਆ ਹੈ', 'Guru grace, Thou hast honoured me, the menial');


SELECT * FROM `testfulltext` WHERE `ScriptureEnglish` REGEXP '[[:<:]][Tt][[:alpha:]]* [Hh][[:alpha:]]* [Hh]'
SELECT * FROM `testfulltext` WHERE `Scripture` REGEXP '[[:<:]][ਦ][[:alpha:]]* [ਦ][[:alpha:]]* [ਦ]'

Any pointer will be appreciated.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: How to search based on first LETTER of consecutive words
2520
April 28, 2013 11:42AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.