Use a PatternReplaceCharFilterFactory to map the periods to empty strings, then use a KeywordTokenizer and a string field type. If you want to sort it or do range queries, you might use an integer field.
> This question was raised here for a few times , but no final solution was
> provided .
> I'am using a combination of ClassicTokenizer and WordDelimiterFactory in my
> Query / Index chain.
> as a result an IP like 192.168.1.3 is indexed as
> 192 - pos1
> 168 - pos2
> 1 - pos3
> 3 - pos4
> 19216813 - pos5
> So searching for a similar ,but different address like 192.168.1.4 will
> return wrong item because of match for all 3 first position.
> So the question is , what is the best way do index / query by IP as number ,
> but using ClassicTokenizer and WordDelimiter ?
> actually I would like to have the IP as num , without breaking it on parts .
> ( have only 19216813 )
> Thanks .
with the stateless script update processor. The update processor could be
hard-coded or take parameters as to which source value to examine and what
field to output. It could use a simple regex to extract only IP addresses.
And then you could output to multiple fields - one for the raw string for
wildcard matches, say, and one as an integer for proximity or range checks.
-- Jack Krupansky
Sent: Monday, May 19, 2014 3:04 PM
To: [hidden email] Subject: Re: Index / Query IP Address as number.
I have a text field containing a large piece of mixed text , like :
test test 12/12/2001 12345 192.168.1.1 1234324
I need to create a copy field which will capture only all IPs from the text
( may be more than one IP ) .
What will be the best way to do ?
I dont see any option to make WordDelimiter to not break down the IP , so as
alternative I will use a copy field .