mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Fixed unreported bug when doing Lucene search across all attributes on types that contain numeric properties
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3123 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -48,6 +48,8 @@ public class DoubleTokenFilter extends Tokenizer
|
|||||||
{
|
{
|
||||||
Token candidate;
|
Token candidate;
|
||||||
while((candidate = baseTokeniser.next()) != null)
|
while((candidate = baseTokeniser.next()) != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
Double d = Double.valueOf(candidate.termText());
|
Double d = Double.valueOf(candidate.termText());
|
||||||
String valueString = NumericEncoder.encode(d.doubleValue());
|
String valueString = NumericEncoder.encode(d.doubleValue());
|
||||||
@@ -55,6 +57,11 @@ public class DoubleTokenFilter extends Tokenizer
|
|||||||
candidate.type());
|
candidate.type());
|
||||||
return doubleToken;
|
return doubleToken;
|
||||||
}
|
}
|
||||||
|
catch (NumberFormatException e)
|
||||||
|
{
|
||||||
|
// just ignore and try the next one
|
||||||
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -48,6 +48,8 @@ public class FloatTokenFilter extends Tokenizer
|
|||||||
{
|
{
|
||||||
Token candidate;
|
Token candidate;
|
||||||
while((candidate = baseTokeniser.next()) != null)
|
while((candidate = baseTokeniser.next()) != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
Float floatValue = Float.valueOf(candidate.termText());
|
Float floatValue = Float.valueOf(candidate.termText());
|
||||||
String valueString = NumericEncoder.encode(floatValue.floatValue());
|
String valueString = NumericEncoder.encode(floatValue.floatValue());
|
||||||
@@ -55,6 +57,11 @@ public class FloatTokenFilter extends Tokenizer
|
|||||||
candidate.type());
|
candidate.type());
|
||||||
return floatToken;
|
return floatToken;
|
||||||
}
|
}
|
||||||
|
catch (NumberFormatException e)
|
||||||
|
{
|
||||||
|
// just ignore and try the next one
|
||||||
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -48,6 +48,8 @@ public class IntegerTokenFilter extends Tokenizer
|
|||||||
{
|
{
|
||||||
Token candidate;
|
Token candidate;
|
||||||
while((candidate = baseTokeniser.next()) != null)
|
while((candidate = baseTokeniser.next()) != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
Integer integer = Integer.valueOf(candidate.termText());
|
Integer integer = Integer.valueOf(candidate.termText());
|
||||||
String valueString = NumericEncoder.encode(integer.intValue());
|
String valueString = NumericEncoder.encode(integer.intValue());
|
||||||
@@ -55,6 +57,11 @@ public class IntegerTokenFilter extends Tokenizer
|
|||||||
candidate.type());
|
candidate.type());
|
||||||
return integerToken;
|
return integerToken;
|
||||||
}
|
}
|
||||||
|
catch (NumberFormatException e)
|
||||||
|
{
|
||||||
|
// just ignore and try the next one
|
||||||
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -19,6 +19,7 @@ package org.alfresco.repo.search.impl.lucene.analysis;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
|
|
||||||
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
import org.apache.lucene.analysis.Token;
|
import org.apache.lucene.analysis.Token;
|
||||||
import org.apache.lucene.analysis.Tokenizer;
|
import org.apache.lucene.analysis.Tokenizer;
|
||||||
import org.apache.lucene.analysis.standard.StandardTokenizer;
|
import org.apache.lucene.analysis.standard.StandardTokenizer;
|
||||||
@@ -48,6 +49,8 @@ public class LongTokenFilter extends Tokenizer
|
|||||||
{
|
{
|
||||||
Token candidate;
|
Token candidate;
|
||||||
while((candidate = baseTokeniser.next()) != null)
|
while((candidate = baseTokeniser.next()) != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
Long longValue = Long.valueOf(candidate.termText());
|
Long longValue = Long.valueOf(candidate.termText());
|
||||||
String valueString = NumericEncoder.encode(longValue.longValue());
|
String valueString = NumericEncoder.encode(longValue.longValue());
|
||||||
@@ -55,6 +58,11 @@ public class LongTokenFilter extends Tokenizer
|
|||||||
candidate.type());
|
candidate.type());
|
||||||
return longToken;
|
return longToken;
|
||||||
}
|
}
|
||||||
|
catch (NumberFormatException e)
|
||||||
|
{
|
||||||
|
// just ignore and try the next one
|
||||||
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user