lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "G.Long" <>
Subject case-insensitive index and queries
Date Wed, 07 Nov 2012 15:50:56 GMT
Hi :)

I would like the "text" field of my index to be case-insensitive.
I'm using a PerFieldAnalyzerWrapper with a standardAnalyzer for this 
field for both indexing and querying. I read that StandardAnalyzer uses 
LowerCaseFilter to lowercase the value of the field but when I run a 
query, it doesn' work.

Here is my query :

IndexSearcher isearcher = new IndexSearcher(directory);
BooleanQuery query = new BooleanQuery();
PerFieldAnalyzerWrapper pfaWrapper = getPerfFieldAnalyzer();

QueryParser parser = new QueryParser(Version.LUCENE_31, key, pfaWrapper);
Query param = parser.parse(value);
query.add(param, BooleanClause.Occur.MUST);

TopFieldCollector collector = TopFieldCollector.create(new 
Sort(SortField.FIELD_DOC), 200000, true, false, false, false);, collector);

The getPerFieldAnalyzer() methods looks like :

             perFieldAnalyzerWrapper = new PerFieldAnalyzerWrapper(new 
             perFieldAnalyzerWrapper.addAnalyzer(FIELD_TEXT, new 
             perFieldAnalyzerWrapper.addAnalyzer(FIELD_TITLE, new 
return perFieldAnalyzerWrapper;

Is there something wrong with this code?

Thank you :)

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message