Uwe:

Bah, I skipped over the tokenizer part. You'd have to use some other
tokenizer than StandardTokenizer to avoid splitting at that level. If
you got "power_shot_black_neo.txt" through the tokenizer as a single
token, though, wouldn't the proper parameters for WordDelimiter do
what he wants?

Erick

On Sat, Jul 29, 2017 at 9:41 AM, Uwe Schindler <[email protected]> wrote:
> No,
> During tokenization, you can't preserve original.
> You can only add the original token to a separate field.
> Uwe
>
> Am 29. Juli 2017 18:33:25 MESZ schrieb Erick Erickson
> <[email protected]>:
>>
>> 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]
>>
>
> --
> Uwe Schindler
> Achterdiek 19, 28357 Bremen
> https://www.thetaphi.de

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

Reply via email to