Unix Technical Forum

NetSearchExtender Question ...

This is a discussion on NetSearchExtender Question ... within the DB2 forums, part of the Database Server Software category; --> Hi, We are trying to perform a very straightforward search but when we compare it to a standard SQL ...


Go Back   Unix Technical Forum > Database Server Software > DB2

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-26-2008, 06:44 PM
Paul Reddin
 
Posts: n/a
Default NetSearchExtender Question ...

Hi,

We are trying to perform a very straightforward search but when we
compare it to a standard SQL LIKE the result set is wrong ???

e.g
select p.oid, p.part_number
from jabs.part as p
where
p.part_number like 'LM%'
;

Finds a part_number (amongst others) of 'LMA1010GMB-40'


the 'equivalent' TEXT search (with index built) of the same Table
doesn't ?????
i.e
select p.oid, p.part_number
from jabs.part as p,
TABLE(db2ext.textsearch('"LM%"','DB2EXT','PART_PAR T_NUMBER_IX',0,500,cast(NULL
as bigint))) t
where
t.PrimKey = p.oid
;

Are we misusing the % wild-card in some way ?
are we correct in assuming t.primkey is derived automatically from the
definition of the table i.e p.oid ?

This just seems too fundamental to be a bug.

Any help appreciated.

Paul.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-26-2008, 06:45 PM
Paul Reddin
 
Posts: n/a
Default Re: NetSearchExtender Question ...

Actually, after further investigation this does look like a
bug/limitation.

The TVF returns the string correctly when the wilcard is applied to
more
of the string.

ie.
......db2ext.textsearch("LMA101%"..........) - finds the part (as
only 2 records match)
......db2ext.textsearch("LMA10%"..........) - finds the part (as
only 2 records match)
......db2ext.textsearch("LMA1%"..........) - finds the part (as only
2 records match).
......db2ext.textsearch("LMA%"..........) - finds the part (as only
2 records match)
......db2ext.textsearch("LM%"..........) - DOESN'T find/include the
part (as 6888 match)

only 1417 of the 6888 matching records are returned, with no error
message!

It appears that maybe there is some limit on the number of records
that can
be returned ??

NB. I actually started using a result limit of 0 rather than the 500
shown
in my previous append.

Any comments would be great, as we are investigating the feasibility
of
using NSE and currently this is a show stopper to going any further
with it.

Many thanks.

Paul.


paul@abacus.co.uk (Paul Reddin) wrote in message news:<1fd2a603.0404150420.216d428c@posting.google. com>...
> Hi,
>
> We are trying to perform a very straightforward search but when we
> compare it to a standard SQL LIKE the result set is wrong ???
>
> e.g
> select p.oid, p.part_number
> from jabs.part as p
> where
> p.part_number like 'LM%'
> ;
>
> Finds a part_number (amongst others) of 'LMA1010GMB-40'
>
>
> the 'equivalent' TEXT search (with index built) of the same Table
> doesn't ?????
> i.e
> select p.oid, p.part_number
> from jabs.part as p,
> TABLE(db2ext.textsearch('"LM%"','DB2EXT','PART_PAR T_NUMBER_IX',0,500,cast(NULL
> as bigint))) t
> where
> t.PrimKey = p.oid
> ;
>
> Are we misusing the % wild-card in some way ?
> are we correct in assuming t.primkey is derived automatically from the
> definition of the table i.e p.oid ?
>
> This just seems too fundamental to be a bug.
>
> Any help appreciated.
>
> Paul.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-26-2008, 06:45 PM
Rob Wilson
 
Posts: n/a
Default Re: NetSearchExtender Question ...

Paul Reddin wrote:
> Actually, after further investigation this does look like a
> bug/limitation.
>
> .....db2ext.textsearch("LMA%"..........) - finds the part (as only
> 2 records match)
> .....db2ext.textsearch("LM%"..........) - DOESN'T find/include the
> part (as 6888 match)
>
> only 1417 of the 6888 matching records are returned, with no error
> message!
>
> It appears that maybe there is some limit on the number of records
> that can
> be returned ??
>
> NB. I actually started using a result limit of 0 rather than the 500
> shown
> in my previous append.
>
> Any comments would be great, as we are investigating the feasibility
> of
> using NSE and currently this is a show stopper to going any further
> with it.
>
> Many thanks.
>
> Paul.
>
>


I would suggest trying this query and see what happens:

select p.oid, p.part_number
from jabs.part as p
where contains(p.part_number, '"LM%"') = 1
;

Please someone correct me if I'm wrong but wouldn't a normal index be
used in this case for a LIKE comparison? If so, then you may want to
consider simply using LIKE with appropriate indexes.

--
Rob Wilson
rob_wilson_at_@ameritech.net (remove _at_)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-26-2008, 06:46 PM
Paul Reddin
 
Posts: n/a
Default Re: NetSearchExtender Question ...

Rob,

fyi: I have opened an official PMR on this now too.

Rob Wilson <rob_wilson_at_@ameritech.net> wrote in message news:<NrRfc.182$IO7.96@newssvr16.news.prodigy.com> ...
> I would suggest trying this query and see what happens:
>
> select p.oid, p.part_number
> from jabs.part as p
> where contains(p.part_number, '"LM%"') = 1
> ;


Tried this, actually got exactly the same behaviour of the Table Function.
>
> Please someone correct me if I'm wrong but wouldn't a normal index be
> used in this case for a LIKE comparison?


I don't think so, as the performance of LIKE '%something' is 100x slower
than CONTAINS(..."%something")
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-26-2008, 06:48 PM
Rob Wilson
 
Posts: n/a
Default Re: NetSearchExtender Question ...

Paul Reddin wrote:
> Rob,
>
> fyi: I have opened an official PMR on this now too.
>


Glad to hear it. I am unable to reproduce this is my environment
(although most of my indexes are built on CLOB and VARCHAR(4000) columns):

UDB v8.1.4 for Win2K
NSE " tx9_812" (" tx9_53a itlR3-60 COSLibR5-15") - I believe NSE fixpak 4.

> Rob Wilson <rob_wilson_at_@ameritech.net> wrote in message news:<NrRfc.182$IO7.96@newssvr16.news.prodigy.com> ...
>
>>I would suggest trying this query and see what happens:
>>
>>select p.oid, p.part_number
>>from jabs.part as p
>>where contains(p.part_number, '"LM%"') = 1
>>;

>
>
> Tried this, actually got exactly the same behaviour of the Table Function.
>
>>Please someone correct me if I'm wrong but wouldn't a normal index be
>>used in this case for a LIKE comparison?

>
>
> I don't think so, as the performance of LIKE '%something' is 100x slower
> than CONTAINS(..."%something")


Ah, but that's a different query than LIKE 'something%'!


--
Rob Wilson
rob_wilson_at_ameritech.net (replace _at_ with @)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-26-2008, 06:56 PM
Paul Reddin
 
Posts: n/a
Default Re: NetSearchExtender Question ...

fyi:

IBM have found the solution to this.

It basically comes down to the "EXPANSION LIMIT" variable. Apparently
, if not specified it defaults to around 1000 (not quite sure of the
full internal implications of this)

Anyway,

Specifying the query as

TABLE(db2ext.textsearch('EXPANSION LIMIT 100000 "LM%"',
'DB2EXT',
'PART_PART_NUMBER_IX',
0,
0,
cast(NULL as bigint))) t

ensures we get the full result set of 8000+ rows.

fwiw:
I'm not convinced the docs. are very clear on this!

Paul


Rob Wilson <rob_wilson_at_@ameritech.net> wrote in message news:<o5Qhc.660$AP4.314@newssvr15.news.prodigy.com >...
> Paul Reddin wrote:
> > Rob,
> >
> > fyi: I have opened an official PMR on this now too.
> >

>

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 09:07 PM.


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