[ic] search spec problem...

mail lists at gmnet.net
Fri Apr 20 10:33:00 EDT 2007


On Fri, 2007-04-20 at 14:24 +0000, mail wrote:
> On Fri, 2007-04-20 at 00:46 +0100, Kevin Walsh wrote:
> > mail <lists at gmnet.net> wrote:
> > > I'm still having trouble with a search spec and I can't seem to solve
> > > it. This entire search-region is inside a loop which is also inside
> > > another loop.  each loop has its own prefix.
> > > 
> > > Here is my search spec:
> > > 
> > >   [search-region
> > >   prefix=resources
> > >   list_prefix=resources_list
> > >   search=|
> > >   fi=resources
> > >   st=db
> > >   co=1
> > >   sf=categorycode
> > >   se=[scratch categorycode]
> > >   op=eq
> > >   nu=0
> > >   sf=topiccode
> > >   se=[scratch topiccode]
> > >   op=eq
> > >   nu=0
> > >   sf=loscore
> > >   se=[scratch score]
> > >   op=<=
> > >   nu=1
> > >   sf=hiscore
> > >   se=[scratch score]
> > >   op=>=
> > >   nu=1
> > >   sf=inactive
> > >   se=1
> > >   op=ne
> > >   nu=0
> > >   ml=none
> > >   |]
> > > 
> > > here is a simplified view of my resources table:
> > > code categorycode topiccode loscore hiscore inactive
> > > 1  1  1   0  .2  0
> > > 2  1  1  .3  .5  0
> > > 3  1  1  .6  .8  0
> > > 4  1  1  .9   1  0 
> > > 5  2  1   0  .2  0
> > > 6  2  1  .3  .5  0
> > > 7  2  1  .6  .8  0
> > > 8  2  1  .9   1  0
> > > 
> > > If I set my scratch variables as follows:
> > > categorycode = 1
> > > topiccode = 1
> > > score = .0000001
> > > I get what you would expect (row 1 only)
> > > 
> > > If I set my scratch variables as follows:
> > > categorycode = 1
> > > topiccode = 1
> > > score = .3333
> > > I get what you would expect (row 2 only)
> > > 
> > > However, If I set my scratch variables this way:
> > > categorycode = 1
> > > topiccode = 1
> > > score = 0
> > > I get rows 1, 2, 3, and 4.
> > > 
> > > I have tried setting the loscore and hiscore fields in the database as
> > > various types including double, float, decimal, and even text.
> > > Does anybody have any ideas? 
> > > 
> > I find that it's much easier to just use SQL for anything other than
> > just a simple search.  Perhaps you should consider using the [query]
> > tag instead.  I'm sure you'll find it much easier to work with and
> > to get going.
> > 
> > It doesn't sound too efficient to have loops nested in the way you've
> > described.  You may be able to create a single SQL query that does the
> > whole job in one loop.
> > 
> > I can't see anything too obvious in your search spec that I can point
> > at for you.  Check that [scratch score] is indeed set to the value you
> > expect.  Perhaps show the value on your page to debug it.   Your
> > "inactive" spec should probably have op=!= and  nu=1, but that's
> > irrelevant to your reported problem.  I really would just use SQL.
> > 
> 
> Thanks for the advice. I have always stayed away from SQL and used the
> search thing because of it's nice way of paging the results.  I make use
> of many of the features such as on-match, no-match, on-change, more-list
> etc.. I guess I will try using SQL for the outside loops and do more
> testing.  At least its good to know that search spec looks OK. I will
> change that inactive thing...

oh right, all that paging stuff is available in the query tag too!
Thanks
rick




More information about the interchange-users mailing list