You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by mechravi25 <me...@yahoo.co.in> on 2012/09/12 15:22:18 UTC

Doubts in PathHierarchyTokenizer

Hi,

Im Using Solr 3.6.1 version and I have a field which is having values like

A|B|C
B|C|D|EE
A|C|B 
A|B|D
..etc..

So, When I search for "A|B", I should get documents starting with 
"A" and "A|B"

To implement this, I've used PathHierarchyTokenizer for the above field as


<fieldType name="filep" class="solr.TextField" positionIncrementGap="100">
 <analyzer type="index">  
<tokenizer class="solr.PathHierarchyTokenizerFactory" pattern="|"/>
 </analyzer>
<analyzer type="query">
    <tokenizer class="solr.KeywordTokenizerFactory" />
</analyzer>
</fieldType>

But, When I use the solr analysis page to check if its being split on the
pipe symbol ("|") on indexing, I see that its being taken as the entire
token and its not getting split on the delimiter (i.e. the searching is done
only for "A|B" in the above case)

I also tried using "\|" as the delimiter but also its not working. 

Am I missing anything here? Or Will the Path Hierarchy not accept pipe
symbol ("|") as delimiter?
Can anyone guide me on this?

Thanks a lot



--
View this message in context: http://lucene.472066.n3.nabble.com/Doubts-in-PathHierarchyTokenizer-tp4007216.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Doubts in PathHierarchyTokenizer

Posted by mechravi25 <me...@yahoo.co.in>.
Thanks a lot koji. It worked.



--
View this message in context: http://lucene.472066.n3.nabble.com/Doubts-in-PathHierarchyTokenizer-tp4007216p4007373.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Doubts in PathHierarchyTokenizer

Posted by Koji Sekiguchi <ko...@r.email.ne.jp>.
Use delimiter option instead of pattern for PathHierarchyTokenizerFactory:

http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.PathHierarchyTokenizerFactory

koji
-- 
http://soleami.com/blog/starting-lab-work.html

(12/09/12 22:22), mechravi25 wrote:
> Hi,
>
> Im Using Solr 3.6.1 version and I have a field which is having values like
>
> A|B|C
> B|C|D|EE
> A|C|B
> A|B|D
> ..etc..
>
> So, When I search for "A|B", I should get documents starting with
> "A" and "A|B"
>
> To implement this, I've used PathHierarchyTokenizer for the above field as
>
>
> <fieldType name="filep" class="solr.TextField" positionIncrementGap="100">
>   <analyzer type="index">
> <tokenizer class="solr.PathHierarchyTokenizerFactory" pattern="|"/>
>   </analyzer>
> <analyzer type="query">
>      <tokenizer class="solr.KeywordTokenizerFactory" />
> </analyzer>
> </fieldType>
>
> But, When I use the solr analysis page to check if its being split on the
> pipe symbol ("|") on indexing, I see that its being taken as the entire
> token and its not getting split on the delimiter (i.e. the searching is done
> only for "A|B" in the above case)
>
> I also tried using "\|" as the delimiter but also its not working.
>
> Am I missing anything here? Or Will the Path Hierarchy not accept pipe
> symbol ("|") as delimiter?
> Can anyone guide me on this?
>
> Thanks a lot
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Doubts-in-PathHierarchyTokenizer-tp4007216.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>