Hello,
I'm banging my head at this point, hoping someone can help me.
I can't get StandardQueryParser to work on numeric fields. Luke v9.8.0
finds the records for me. Example search query string in Luke that works:
eventIdNum:3001
Here is my code:
Query initQuery() {
StandardQueryParser p = new StandardQueryParser( analyzer );
p.setDefaultOperator( StandardQueryConfigHandler.Operator.AND );
String queryString = "eventIdNum:3001";
return p.parse( queryString, "any" );
}
here is how the field was added to the index:
d.add( new IntField( "eventIdNum", 3001, Field.Store.NO ) );
I've tried various analyzers. Example: new StandardAnalyzer(
CharArraySet.EMPTY_SET );
I'm sure there is something I'm missing here, but I can't seem to track down
what I'm missing. The analyzer is the exact same analyzer I'm using during
indexing. It's a PerFieldAnalyzerWrapper. The specific analyzer for the
numeric fields is the one I mentioned above (StandardAnalyzer).
The query used is:
indexSearcher.search( query, 10 );
Thank you,
Tony Schwartz
I'm banging my head at this point, hoping someone can help me.
I can't get StandardQueryParser to work on numeric fields. Luke v9.8.0
finds the records for me. Example search query string in Luke that works:
eventIdNum:3001
Here is my code:
Query initQuery() {
StandardQueryParser p = new StandardQueryParser( analyzer );
p.setDefaultOperator( StandardQueryConfigHandler.Operator.AND );
String queryString = "eventIdNum:3001";
return p.parse( queryString, "any" );
}
here is how the field was added to the index:
d.add( new IntField( "eventIdNum", 3001, Field.Store.NO ) );
I've tried various analyzers. Example: new StandardAnalyzer(
CharArraySet.EMPTY_SET );
I'm sure there is something I'm missing here, but I can't seem to track down
what I'm missing. The analyzer is the exact same analyzer I'm using during
indexing. It's a PerFieldAnalyzerWrapper. The specific analyzer for the
numeric fields is the one I mentioned above (StandardAnalyzer).
The query used is:
indexSearcher.search( query, 10 );
Thank you,
Tony Schwartz