Tag search with zend_search_lucene

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Tag search with zend_search_lucene

Borja Martín
Hi,
I want to index a document that has a field called 'tags' that looks  
like that : 'foo, foo bar'
The comma is the separator for each tag, so I have a tag with the value
'foo' and another one with 'foo bar'
What I want to do is to be able to retrieve the documents with certain
tag(only one tag per query), so if I search by 'foo', this document  
should be hit, as well as if I search by 'foo bar', but if I enter 'bar'
as the tag, it shouldn't although it is being retrieved too.
I tried to index the field as keyword and as text(I know so it's
tokenized so it shouldn't work at all) and tried several queries with no
success.
Any tip to achieve what I want? Should I write my own analyzer?
I know the java implementation has something like term vectors and this
could probably solve the problem, but I don't if the Zend version
implements this feature...
Thanks in advance.

Regards
Reply | Threaded
Open this post in threaded view
|

Re: Tag search with zend_search_lucene

Pieter Kokx
Hi,

You can put it in a UnStored or Text field. Then it will be tokenized
correctly and you will be able to search for it ;).

Regards,

Pieter Kokx
MaakSite.net
PHP Developer



Borja Martín schreef:

> Hi,
> I want to index a document that has a field called 'tags' that looks
> like that : 'foo, foo bar'
> The comma is the separator for each tag, so I have a tag with the
> value 'foo' and another one with 'foo bar'
> What I want to do is to be able to retrieve the documents with certain
> tag(only one tag per query), so if I search by 'foo', this document
> should be hit, as well as if I search by 'foo bar', but if I enter
> 'bar' as the tag, it shouldn't although it is being retrieved too.
> I tried to index the field as keyword and as text(I know so it's
> tokenized so it shouldn't work at all) and tried several queries with
> no success.
> Any tip to achieve what I want? Should I write my own analyzer?
> I know the java implementation has something like term vectors and
> this could probably solve the problem, but I don't if the Zend version
> implements this feature...
> Thanks in advance.
>
> Regards
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Tag search with zend_search_lucene

Borja Martín
Hi,
the problem with this approach is that "foo bar" will be tokenized and when I search for the tag "bar" the document will be retrieved although it shouldn't.
Someone suggested to write my own tokenizer so that it splits the words using the comma as the separator but I didn't find any info about this...

Regards

Pieter Kokx escribió:
Hi,

You can put it in a UnStored or Text field. Then it will be tokenized
correctly and you will be able to search for it ;).

Regards,

Pieter Kokx
MaakSite.net
PHP Developer



Borja Martín schreef:
  
Hi,
I want to index a document that has a field called 'tags' that looks 
like that : 'foo, foo bar'
The comma is the separator for each tag, so I have a tag with the
value 'foo' and another one with 'foo bar'
What I want to do is to be able to retrieve the documents with certain
tag(only one tag per query), so if I search by 'foo', this document 
should be hit, as well as if I search by 'foo bar', but if I enter
'bar' as the tag, it shouldn't although it is being retrieved too.
I tried to index the field as keyword and as text(I know so it's
tokenized so it shouldn't work at all) and tried several queries with
no success.
Any tip to achieve what I want? Should I write my own analyzer?
I know the java implementation has something like term vectors and
this could probably solve the problem, but I don't if the Zend version
implements this feature...
Thanks in advance.

Regards



    

  


-- 
/**
 * dagi3d v4 - http://dagi3d.net
 */