Unix Technical Forum

Full Text Searching Help

This is a discussion on Full Text Searching Help within the MySQL forums, part of the Database Server Software category; --> So, I understand how to do it, and it works for the most part; for example if my code ...


Go Back   Unix Technical Forum > Database Server Software > MySQL

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-09-2008, 02:37 PM
zackrspv
 
Posts: n/a
Default Full Text Searching Help

So, I understand how to do it, and it works for the most part; for
example if my code is:

SELECT * FROM info WHERE MATCH(term) AGAINST ('relative')

I get around 5 results, such as the following:

Relative Strength
Relative Return
Price-Earnings Relative
Relative Strength Index (RSI)
Relative Vigor Index (RVI)
Relative Purchase Power Parity

But, let us assume that we are searching for 'RSI':

SELECT * FROM info WHERE MATCH(term) AGAINST ('RSI')

When we do that, boom, no results; yet we can clearly SEE that RSI
does exist in the terms above.

How can i get it to return the result?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 03-09-2008, 02:37 PM
zackrspv
 
Posts: n/a
Default Re: Full Text Searching Help

On Mar 7, 12:15 pm, zackrspv <old...@gmail.com> wrote:
> So, I understand how to do it, and it works for the most part; for
> example if my code is:
>
> SELECT * FROM info WHERE MATCH(term) AGAINST ('relative')
>
> I get around 5 results, such as the following:
>
> Relative Strength
> Relative Return
> Price-Earnings Relative
> Relative Strength Index (RSI)
> Relative Vigor Index (RVI)
> Relative Purchase Power Parity
>
> But, let us assume that we are searching for 'RSI':
>
> SELECT * FROM info WHERE MATCH(term) AGAINST ('RSI')
>
> When we do that, boom, no results; yet we can clearly SEE that RSI
> does exist in the terms above.
>
> How can i get it to return the result?


Note, also, that I can use the following code as well and it works
fine:

SELECT * FROM info WHERE MATCH(term) AGAINST ('+RSI' IN BOOLEAN MODE)

But if i try and specify RSI in there:

Still, no results.

So, maybe i'm just confused on how to do it, or i just don't get it :/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 03-09-2008, 02:37 PM
zackrspv
 
Posts: n/a
Default Re: Full Text Searching Help

>
> SELECT * FROM info WHERE MATCH(term) AGAINST ('+RSI' IN BOOLEAN MODE)
>


Ooops, meant:

SELECT * FROM info WHERE MATCH(term) AGAINST ('+relative +strength' IN
BOOLEAN MODE)

haha, of course i meant to say that the quote text above DIDN'T work
lol sorry, i'm a bit tired i guess.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 03-09-2008, 02:37 PM
Hoss
 
Posts: n/a
Default Re: Full Text Searching Help

On Mar 7, 3:22*pm, zackrspv <old...@gmail.com> wrote:
> > SELECT * FROM info WHERE MATCH(term) AGAINST ('+RSI' IN BOOLEAN MODE)

>
> Ooops, meant:
>
> SELECT * FROM info WHERE MATCH(term) AGAINST ('+relative +strength' IN
> BOOLEAN MODE)
>
> haha, of course i meant to say that the quote text above DIDN'T work
> lol sorry, i'm a bit tired i guess.


Two possible things to start. I don't remember how MySQL handles the
'(', but it is possible that it is looking for the 'word' 'RSI' and is
not matching it because it finds the 'word' '(RSI)'

The other, more likely explaination is that the minimum word length is
set to 4 characters, so it's just ignoring RSI.

Check out this link

http://dev.mysql.com/doc/refman/5.0/...ne-tuning.html

and look for 'ft_min_word_len'
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 03-09-2008, 02:37 PM
Jerry Stuckle
 
Posts: n/a
Default Re: Full Text Searching Help

zackrspv wrote:
> So, I understand how to do it, and it works for the most part; for
> example if my code is:
>
> SELECT * FROM info WHERE MATCH(term) AGAINST ('relative')
>
> I get around 5 results, such as the following:
>
> Relative Strength
> Relative Return
> Price-Earnings Relative
> Relative Strength Index (RSI)
> Relative Vigor Index (RVI)
> Relative Purchase Power Parity
>
> But, let us assume that we are searching for 'RSI':
>
> SELECT * FROM info WHERE MATCH(term) AGAINST ('RSI')
>
> When we do that, boom, no results; yet we can clearly SEE that RSI
> does exist in the terms above.
>
> How can i get it to return the result?
>


From the MySQL manual under full text searches:

"Any word that is too short is ignored. The default minimum length of
words that are found by full-text searches is four characters"

RSI is, of course, shorter than that.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 03-09-2008, 02:37 PM
zackrspv
 
Posts: n/a
Default Re: Full Text Searching Help

On Mar 7, 2:09 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> zackrspv wrote:
> > So, I understand how to do it, and it works for the most part; for
> > example if my code is:

>
> > SELECT * FROM info WHERE MATCH(term) AGAINST ('relative')

>
> > I get around 5 results, such as the following:

>
> > Relative Strength
> > Relative Return
> > Price-Earnings Relative
> > Relative Strength Index (RSI)
> > Relative Vigor Index (RVI)
> > Relative Purchase Power Parity

>
> > But, let us assume that we are searching for 'RSI':

>
> > SELECT * FROM info WHERE MATCH(term) AGAINST ('RSI')

>
> > When we do that, boom, no results; yet we can clearly SEE that RSI
> > does exist in the terms above.

>
> > How can i get it to return the result?

>
> From the MySQL manual under full text searches:
>
> "Any word that is too short is ignored. The default minimum length of
> words that are found by full-text searches is four characters"
>
> RSI is, of course, shorter than that.
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================


now see that just sucks; how can i get it to display the results if my
clients are searching for things like RSI, RVI, ESS, etc. Most of the
don't know what they mean, and the terms would still have to display
that. If i can't use a full text search, i'd use %like% but that'd be
pointless as it would return other things like 'RSI' for 'version' and
'conversion'.

Any ideas on a way to get around this?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 03-09-2008, 02:37 PM
Jerry Stuckle
 
Posts: n/a
Default Re: Full Text Searching Help

zackrspv wrote:
> On Mar 7, 2:09 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
>> zackrspv wrote:
>>> So, I understand how to do it, and it works for the most part; for
>>> example if my code is:
>>> SELECT * FROM info WHERE MATCH(term) AGAINST ('relative')
>>> I get around 5 results, such as the following:
>>> Relative Strength
>>> Relative Return
>>> Price-Earnings Relative
>>> Relative Strength Index (RSI)
>>> Relative Vigor Index (RVI)
>>> Relative Purchase Power Parity
>>> But, let us assume that we are searching for 'RSI':
>>> SELECT * FROM info WHERE MATCH(term) AGAINST ('RSI')
>>> When we do that, boom, no results; yet we can clearly SEE that RSI
>>> does exist in the terms above.
>>> How can i get it to return the result?

>> From the MySQL manual under full text searches:
>>
>> "Any word that is too short is ignored. The default minimum length of
>> words that are found by full-text searches is four characters"
>>
>> RSI is, of course, shorter than that.
>>
>> --
>> ==================
>> Remove the "x" from my email address
>> Jerry Stuckle
>> JDS Computer Training Corp.
>> jstuck...@attglobal.net
>> ==================

>
> now see that just sucks; how can i get it to display the results if my
> clients are searching for things like RSI, RVI, ESS, etc. Most of the
> don't know what they mean, and the terms would still have to display
> that. If i can't use a full text search, i'd use %like% but that'd be
> pointless as it would return other things like 'RSI' for 'version' and
> 'conversion'.
>
> Any ideas on a way to get around this?
>


Check the docs. That's the default; you can change it. I don't
remember the exact parm offhand - never had to change it, myself.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 03-09-2008, 02:37 PM
zackrspv
 
Posts: n/a
Default Re: Full Text Searching Help

On Mar 7, 5:39 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> zackrspv wrote:
> > On Mar 7, 2:09 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> >> zackrspv wrote:
> >>> So, I understand how to do it, and it works for the most part; for
> >>> example if my code is:
> >>> SELECT * FROM info WHERE MATCH(term) AGAINST ('relative')
> >>> I get around 5 results, such as the following:
> >>> Relative Strength
> >>> Relative Return
> >>> Price-Earnings Relative
> >>> Relative Strength Index (RSI)
> >>> Relative Vigor Index (RVI)
> >>> Relative Purchase Power Parity
> >>> But, let us assume that we are searching for 'RSI':
> >>> SELECT * FROM info WHERE MATCH(term) AGAINST ('RSI')
> >>> When we do that, boom, no results; yet we can clearly SEE that RSI
> >>> does exist in the terms above.
> >>> How can i get it to return the result?
> >> From the MySQL manual under full text searches:

>
> >> "Any word that is too short is ignored. The default minimum length of
> >> words that are found by full-text searches is four characters"

>
> >> RSI is, of course, shorter than that.

>
> >> --
> >> ==================
> >> Remove the "x" from my email address
> >> Jerry Stuckle
> >> JDS Computer Training Corp.
> >> jstuck...@attglobal.net
> >> ==================

>
> > now see that just sucks; how can i get it to display the results if my
> > clients are searching for things like RSI, RVI, ESS, etc. Most of the
> > don't know what they mean, and the terms would still have to display
> > that. If i can't use a full text search, i'd use %like% but that'd be
> > pointless as it would return other things like 'RSI' for 'version' and
> > 'conversion'.

>
> > Any ideas on a way to get around this?

>
> Check the docs. That's the default; you can change it. I don't
> remember the exact parm offhand - never had to change it, myself.
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================


Well, I can't change it on my host as i'm on a shared account. The
host refuses to change it as well, they consider it a security risk,
tho I do not see how. There has to be an alternate way to do this,
such as using regular expressions, etc, but i'm not sure; how can I
accomplish what I need?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 03-09-2008, 02:37 PM
Jerry Stuckle
 
Posts: n/a
Default Re: Full Text Searching Help

zackrspv wrote:
> On Mar 7, 5:39 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
>> zackrspv wrote:
>>> On Mar 7, 2:09 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
>>>> zackrspv wrote:
>>>>> So, I understand how to do it, and it works for the most part; for
>>>>> example if my code is:
>>>>> SELECT * FROM info WHERE MATCH(term) AGAINST ('relative')
>>>>> I get around 5 results, such as the following:
>>>>> Relative Strength
>>>>> Relative Return
>>>>> Price-Earnings Relative
>>>>> Relative Strength Index (RSI)
>>>>> Relative Vigor Index (RVI)
>>>>> Relative Purchase Power Parity
>>>>> But, let us assume that we are searching for 'RSI':
>>>>> SELECT * FROM info WHERE MATCH(term) AGAINST ('RSI')
>>>>> When we do that, boom, no results; yet we can clearly SEE that RSI
>>>>> does exist in the terms above.
>>>>> How can i get it to return the result?
>>>> From the MySQL manual under full text searches:
>>>> "Any word that is too short is ignored. The default minimum length of
>>>> words that are found by full-text searches is four characters"
>>>> RSI is, of course, shorter than that.
>>>> --
>>>> ==================
>>>> Remove the "x" from my email address
>>>> Jerry Stuckle
>>>> JDS Computer Training Corp.
>>>> jstuck...@attglobal.net
>>>> ==================
>>> now see that just sucks; how can i get it to display the results if my
>>> clients are searching for things like RSI, RVI, ESS, etc. Most of the
>>> don't know what they mean, and the terms would still have to display
>>> that. If i can't use a full text search, i'd use %like% but that'd be
>>> pointless as it would return other things like 'RSI' for 'version' and
>>> 'conversion'.
>>> Any ideas on a way to get around this?

>> Check the docs. That's the default; you can change it. I don't
>> remember the exact parm offhand - never had to change it, myself.
>>
>> --
>> ==================
>> Remove the "x" from my email address
>> Jerry Stuckle
>> JDS Computer Training Corp.
>> jstuck...@attglobal.net
>> ==================

>
> Well, I can't change it on my host as i'm on a shared account. The
> host refuses to change it as well, they consider it a security risk,
> tho I do not see how. There has to be an alternate way to do this,
> such as using regular expressions, etc, but i'm not sure; how can I
> accomplish what I need?
>


Not easily, I'm afraid. You might be able to do it with a regex, but
I'm not good at regex's.

And I don't really blame your hosting company - it wouldn't be a
security risk, but searching on short words can load down the server.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 03-09-2008, 02:37 PM
Hoss
 
Posts: n/a
Default Re: Full Text Searching Help

On Mar 8, 1:01*pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> zackrspv wrote:
> > On Mar 7, 5:39 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> >> zackrspv wrote:
> >>> On Mar 7, 2:09 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> >>>> zackrspv wrote:
> >>>>> So, I understand how to do it, and it works for the most part; for
> >>>>> example if my code is:
> >>>>> SELECT * FROM info WHERE MATCH(term) AGAINST ('relative')
> >>>>> I get around 5 results, such as the following:
> >>>>> Relative Strength
> >>>>> Relative Return
> >>>>> Price-Earnings Relative
> >>>>> Relative Strength Index (RSI)
> >>>>> Relative Vigor Index (RVI)
> >>>>> Relative Purchase Power Parity
> >>>>> But, let us assume that we are searching for 'RSI':
> >>>>> SELECT * FROM info WHERE MATCH(term) AGAINST ('RSI')
> >>>>> When we do that, boom, no results; yet we can clearly SEE that RSI
> >>>>> does exist in the terms above.
> >>>>> How can i get it to return the result?
> >>>> *From the MySQL manual under full text searches:
> >>>> "Any word that is too short is ignored. The default minimum length of
> >>>> words that are found by full-text searches is four characters"
> >>>> RSI is, of course, shorter than that.
> >>>> --
> >>>> ==================
> >>>> Remove the "x" from my email address
> >>>> Jerry Stuckle
> >>>> JDS Computer Training Corp.
> >>>> jstuck...@attglobal.net
> >>>> ==================
> >>> now see that just sucks; how can i get it to display the results if my
> >>> clients are searching for things like RSI, RVI, ESS, etc. *Most of the
> >>> don't know what they mean, and the terms would still have to display
> >>> that. If i can't use a full text search, i'd use %like% but that'd be
> >>> pointless as it would return other things like 'RSI' for 'version' and
> >>> 'conversion'.
> >>> Any ideas on a way to get around this?
> >> Check the docs. *That's the default; you can change it. *I don't
> >> remember the exact parm offhand - never had to change it, myself.

>
> >> --
> >> ==================
> >> Remove the "x" from my email address
> >> Jerry Stuckle
> >> JDS Computer Training Corp.
> >> jstuck...@attglobal.net
> >> ==================

>
> > Well, I can't change it on my host as i'm on a shared account. *The
> > host refuses to change it as well, they consider it a security risk,
> > tho I do not see how. *There has to be an alternate way to do this,
> > such as using regular expressions, etc, but i'm not sure; how can I
> > accomplish what I need?

>
> Not easily, I'm afraid. *You might be able to do it with a regex, but
> I'm not good at regex's.
>
> And I don't really blame your hosting company - it wouldn't be a
> security risk, but searching on short words can load down the server.
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================


If the hosting is not willing to change the minimum word length, then
you can use a regular expression with a word boundary.

For instance, using your example:

SELECT * FROM info
WHERE term REGEXP '[[:<:]]RSI[[:>:]]'

Look at the following two links:

http://dev.mysql.com/doc/refman/5.0/en/regexp.html
http://dev.mysql.com/doc/refman/5.0/...-matching.html

The regular expression checking will probably be a little slower than
the fulltext search, but it might be your only choice.

I hope this helps.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:15 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com