[Xapian-discuss] How to build a shopping product categorization system?

James Aylett james-xapian at tartarus.org
Sat Jul 29 23:05:01 BST 2006


On Tue, Jul 25, 2006 at 10:25:00AM -0800, oscaruser at programmer.net wrote:

> We have a predefined tree of categories e.g. 
> 
> Apparel & Accessories -> Clothing -> Women's Apparel -> Business
>	  Casual -> Blazers
> 
> Is there a way to modify the index script (passed to scriptindex) to
> associate this information with the URL or Xapian record such that
> when a search is executed against a search term, the categorization
> information appears in a structured fashion defined by our omega
> template?

If you turn it into a document data field, you can use $split to chop
it up. Say you store the above as "Apparel &
Accessories/Clothing/...", you could have:

categories: field=categories

$list{$map{$split{/, $field{categories}},<span
class='category'>$html{$_}</span>}, -&gt; }

If you stored tokens instead of strings you could turn them into links
as well by using a $setmap{}. (You can also localize that way, if you
need to.)

James

-- 
/--------------------------------------------------------------------------\
  James Aylett                                                  xapian.org
  james at tartarus.org                               uncertaintydivision.org



More information about the Xapian-discuss mailing list