[ic] searching with numbers

mail lists at gmnet.net
Wed Apr 18 15:06:16 EDT 2007


On Wed, 2007-04-18 at 14:54 -0400, mail wrote:
> On Wed, 2007-04-18 at 19:05 +0100, Kevin Walsh wrote:
> > mail <lists at gmnet.net> wrote:
> > > Hi, I have an interesting problem when trying to search for data within
> > > a number range.
> > > 
> > > The table that I am searching has a "loscore" column, and a "hiscore"
> > > column and defines the "range" of that row. the total range would be
> > > between -1 and 1. 
> > > 
> > > I have a search area that looks for data within that range based on a
> > > "score".  the "score" is set in a scratch variable, the score can be
> > > anywhere from -1 to 1.  
> > > 
> > > I have the following in a search area:
> > > 
> > >   sf=loscore
> > >   se=[scratch score]
> > >   op=<=
> > >   nu=1
> > >   sf=hiscore
> > >   se=[scratch score]
> > >   op=>=
> > >   nu=1
> > > 
> > > Is this the right way to do it? I must be doing something wrong, because
> > > when the "score" is 0, all rows are returned. What is the best way to do
> > > this type of search?
> > > 
> > You probably only need to add "co=1" to your search spec:
> > 
> >     http://www.interchange.rtfm.info/icdocs/Interchange_search_engine.html#Coordinated_and_joined_searches
> > 
> 
> Hi Kevin, sorry i didn't post the whole thing, here it is. I do have
> that in there. I am also narrowing it down even further than that. I am
> inside another loop where I setting a "topiccode" and a "categorycode"
> 
>   [search-region
>   prefix=resources
>   list_prefix=resources_list
>   search=|
>   fi=resources
>   st=db
>   co=1
>   sf=categorycode
>   se=[scratch categorycode]
>   op=eq
>   sf=topiccode
>   se=[scratch topiccode]
>   op=eq
>   sf=loscore
>   se=[scratch score]
>   op=<=
>   nu=1
>   sf=hiscore
>   se=[scratch score]
>   op=>=
>   nu=1
>   sf=inactive
>   se=1
>   op=ne
>   ml=none
>   |]
> 
> If my [scratch score] is 0, it grabs all the rows in "resources" table
> that match topiccode and categorycode. even if the loscore is .5 for
> that row...  If the score is .1 or something, then it seems to only grab
> the row that is in "range". Is there something else that I am missing?
> 
> Thanks again
> Rick

Another note, I am using MySQL for the table, and the field type for
loscore and hiscore is "double" is the the right type of field for
this? 



More information about the interchange-users mailing list