To return the first 500 chars of a field us the substring(str, pos, len)
function:
example
Select substring(field, 0, 500) as First500 from my_table where
something=something else;





Matthew Scarrow
ComIT Solutions Inc.
www.comit.ca
Phone: 519-442-0100
Fax:   519-442-0429


-----Original Message-----
From: Kyle W. Kelly [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 16, 2002 7:47 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: Beginner's question


I apologize for giving yall the wrong query.  The incorrect query simply
gives the matching webpages.  The query that returns the page is simple.

select page where webpage='previously obtained page.html'

Additionally, for the sake of completeness, the table for the word is the
following:

table word (
    word varchar(250) not null,
    webpage varchar(249) not null,
    count        numeric not null,
    primary key (word,webpage),
    index (word,webpage)
);
Many thanks for all of the help.
Second question is it possible to only request a portion of a text value?
In other words, could I just return the first 500 bytes of a text value?

----- Original Message -----
From: "Matthew Scarrow" <[EMAIL PROTECTED]>
To: "Kyle and Beth Kelly" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, July 16, 2002 9:14 AM
Subject: RE: Beginner's question


> Try adding a primary key to the table.
>
> alter table webpage add autoid INT UNSIGNED NOT NULL PRIMARY KEY
> AUTO_INCREMENT
>
> This will help the database functions search through the table quicker.
>
> I think another area where the query is getting slowed down is in the
> translation of the Java. Java is a translated language meaning it gets
> compiled when it is run unlike other languages like c++ so you will see
more
> delay when dealing with java as the interface between you and the
database.
>
> Maybe running the query in the mysqlclient program and see what the
response
> time is compared to jsp. If you see a big difference in response then it
has
> something to do with the middle man.
>
> I can't think of anything else that will help you.
>
>
> Matthew Scarrow
> ComIT Solutions Inc.
> www.comit.ca
> Phone: 519-442-0100
> Fax:   519-442-0429
>
>
> -----Original Message-----
> From: Kyle and Beth Kelly [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 15, 2002 8:00 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Beginner's question
>
>
> Question 1.
>
>      I am using Java Server Pages on my search engine.  Here is a link
> (http://66.190.209.122/arachnid/search.jsp)
>
> Question 2.
>
>     The query is created on the fly, but the general format is:
>     select w1.webpage, ... sum(w1.count .... and wn.count) as count
>     from word as w1, ...word as wn
>     where (w1.word='something' .... and wn.word='somethingelse' and
>                 w1.webpage=w2.webpage ... and wn-1.webpage=wn.webpage)
>     group by webpage order by 2 desc
>
> Question 3.
>
>     I dont know what full text indexing means.
>
> Question 4.
>
>     The table structure is the following:
>
>     table webpage (
>         webpage    varchar(166) not null,
>         host            varchar(166) not null,
>         file              varchar(255) not null,
>         level            numeric not null,
>         title             varchar(166),
>         description    varchar(255),
>         page            text not null,
>         day            date not null,
>         primary key (host, file),
>         index(title,webpage,host),
>     );
>
>
> ----- Original Message -----
> From: "Matthew Scarrow" <[EMAIL PROTECTED]>
> To: "Kyle and Beth Kelly" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Sunday, July 14, 2002 7:35 PM
> Subject: RE: Beginner's question
>
>
> > Can you provide more information like are you using cgi to get the code
> and
> > what language. What's your query look like? Are you full text indexing
> your
> > text field? Do you have an index on the table? What's the table
structure
> > look like? Can you send a sample record? How many records in the table?
> >
> > I query on text fields that hold html code all the time and use c++ cgi.
> It
> > takes less then a second to return my query. So probably going to need
> more
> > info. Thanks.
> >
> >
> >
> > Matthew Scarrow
> > ComIT Solutions Inc.
> > www.comit.ca
> > Phone: 519-442-0100
> > Fax:   519-442-0429
> >
> >
> > -----Original Message-----
> > From: Kyle and Beth Kelly [mailto:[EMAIL PROTECTED]]
> > Sent: Sunday, July 14, 2002 7:16 PM
> > To: [EMAIL PROTECTED]
> > Subject: Beginner's question
> >
> >
> > I am writting a search engine using Mysql.  I am trying to return a text
> > object value ( which contains all of the html), but it is taking about
10
> > seconds to return each text value matching my query.  Is there any way
> that
> > a text value can be optimized?
> >
> > www.cs.uno.edu/~kkelly
> >
> >
> > ---------------------------------------------------------------------
> > Before posting, please check:
> >    http://www.mysql.com/manual.php   (the manual)
> >    http://lists.mysql.com/           (the list archive)
> >
> > To request this thread, e-mail <[EMAIL PROTECTED]>
> > To unsubscribe, e-mail
> <[EMAIL PROTECTED]>
> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> >
> >
> >
> > ---------------------------------------------------------------------
> > Before posting, please check:
> >    http://www.mysql.com/manual.php   (the manual)
> >    http://lists.mysql.com/           (the list archive)
> >
> > To request this thread, e-mail <[EMAIL PROTECTED]>
> > To unsubscribe, e-mail
> <[EMAIL PROTECTED]>
> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>
>
>
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to