I don't do lucene level coding much these days, but taking a quick
look at addTokenizer, shouldn't you be adding parameters to it to
control this behavior like preserveOriginal?

Best,
Erick

On Fri, Jul 28, 2017 at 10:45 PM, sandesh.yapuram
<[email protected]> wrote:
> Hello,
> I'm using apache lucene 6.3.0 and I'm trying to implement a custom analyzer
> for my index which allows searching on filenames. The problem is I want to
> allow the user to search using the exact filename also, but the Analyzer
> only has individual tokens and not the original filename as one of the
> token.
>
>     Analyzer analyzer = CustomAnalyzer.builder()
>                    .withTokenizer(StandardTokenizerFactory.class)
>                    .addTokenFilter(LowerCaseFilterFactory.class)
>                    .addTokenFilter(WordDelimiterFilterFactory.class)
>                    .build();
>
> Input:- power_shot_black_neo.txt
>
> Expected Output:-
> power_shot_black_neo.txt
> power
> shot
> black
> neo
> txt
>
>
> Actual output:-
> power
> shot
> black
> neo
> txt
>
>
> Regards,
> Sandesh
>
>
>
>
> --
> View this message in context: 
> http://lucene.472066.n3.nabble.com/Preserve-the-original-input-string-token-in-while-making-a-CustomAnalyzer-tp4348162.html
> Sent from the Lucene - Java Developer mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to