That's right way to manage tags. 
One correction. Keyword fields are not tokenized. Use Text or UnStored field 
types. Otherwise only documents with exactly one tag will be matched.
 
With best regards,
   Alexander Veremyev.

> -----Original Message-----
> From: Christophe OLLIER [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, September 18, 2007 1:37 PM
> To: Carl.Vondrick
> Cc: fw-general@lists.zend.com
> Subject: Re: [fw-general] Lucene and n:m
> 
> Carl.Vondrick a écrit :
> > What is the best way to do a many-to-many relationship in 
> Zend_Search_Lucene? 
> > For instance, suppose I have index of a blog and I wish for 
> users to 
> > be able to search by a tag.  A post can have many tags and 
> a tag can 
> > have many posts.
> >
> > The approach I would like to take to index is:
> >
> > <?php
> > foreach ($tags as $tag)
> > {
> >   
> $document->addField(Zend_Search_Lucene_Field::Keyword($tag, 'tag')); 
> > } ?>
> >   
> We have a similar setup, we just concatenate the tags :
> 
> $document->addField(Zend_Search_Lucene_Field::Keyword(implode(
> ', ', $tags), 'tag'));
> 
> 
> --
> Christophe
> 
> 
> 
> No virus found in this incoming message.
> Checked by AVG Free Edition. 
> Version: 7.5.487 / Virus Database: 269.13.22/1013 - Release 
> Date: 17.09.2007 13:29
>  
> 

No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.487 / Virus Database: 269.13.22/1013 - Release Date: 17.09.2007 
13:29
 

Reply via email to