MiniVend Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

Re: coordinated dic-search



******    message to minivend-users from mikeh@minivend.com     ******

Quoting Thomas Walter (tw@mail.itreff.de):
> 
> Hiho again... ;-)

Thanks for your nice summary of Euro pricing. 8-) I like to answer
questions for people who do that kind of thing....

> 
> I have a products.asc-file containing the usual stuff plus a category
> and a subcategory field.
> To speed up searching I use the binary search (dictionary-files are
> created with Database INDEX) for both fields.
> 
> Now two questions I had in the last 20 minutes assuming the above
> setup...
> 
> 1.
> How do I search for items that are in subcategory X of category Y using
> the binary search (using the normal search works: [area scan
> sf=category/se=Y/sf=subcategory/se=X]).
> But if I try to do this with the binary search it does not...

You can do it without a special index file by:

    <A HREF="[href scan
                dl=Y
                di=category
                co=yes
                sf=products:subcategory
                se=X
            ]"> Y -> X </A>

But that takes a database access. It will not be too bad in most cases
if your list of products returned is less than say 1,000.

You can also make a special index file:

 category   subcategory code
X           Z           00-0011
Y           X           00-0012
Y           Z           00-0013

then you could do:

    <A HREF="[href scan
                dl=Y
                di=-1
                fi=products.asc.category
                rf=2
                co=yes
                sf=subcategory
                se=X
                su=yes
            ]"> Y -> X </A>

Or my favorite is to concat the fields in the index:

 catsubcat   code
XZ           00-0011
YX           00-0012
YZ           00-0013

    
    <A HREF="[href scan
                dl=[loop-code][loop-code-2]
                di=-1
				rf=1
				ra=yes
                fi=my.index
            ]"> Y -> X </A>

That is really fast.

You can create my.index periodically with:

[tag op=log file=">products/my.index"] catsubcat	code
[loop search="ra=yes/tf=category/tf=subcategory/ml=100000"][loop-field category][loop-field subcategory]	[loop-code]
[/loop][/tag]

(The space before the header line is intentional -- that way it
sorts first for the Search::Dict module. Otherwise you could have
wrong results returned.)

A cron job can do it, or you can put it on a database upload page. Perhaps
I should have an OnLoad macro for import? That would be interesting.

There are a million ways to go about it; here is one place where SQL
can be quite nice.

-- 
Mike Heins                          http://www.minivend.com/  ___ 
                                    Internet Robotics        |_ _|____
Few blame themselves until they     131 Willow Lane, Floor 2  | ||  _ \
have exhausted all other            Oxford, OH  45056         | || |_) |
possibilities.                      <mikeh@minivend.com>     |___|  _ <
 -- anonymous                       513.523.7621 FAX 7501        |_| \_\
-
To unsubscribe from the list, DO NOT REPLY to this message.  Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list


Search for: Match: Format: Sort by: