Hi Folks,

I have an issue which I hope someone can help me with.

I've developed a custom analyzer which is working perfectly well during indexing, formats dates & numbers and everything else just as we require for proficient indexing.

When searching it works fine for single fields, but if i need to search on a Range the custom parser is not invoked to format the field correctly and I'm wondering if anyone has any idea why or what i need to do to correct the problem.

For example, the following works perfectly
var queryRunner = new lugen.lib.QueryRunner("DATE_CREATED:27-May-2009");

but this does not, the custom parser which format dates/numbers etc correctly does not get invoked. var queryRunner = new lugen.lib.QueryRunner("DATE_CREATED:[1-Jan-2008 TO 31-DEC-2010]");

Anyone any ideas what could be happening, or an approach I should take to get it working, I'm sure I'm doing something wrong as this must be a requirement for many people.

Kind Regards

Noel Lysaght

I include the QueryRunner class for completeness. It just invokes a QueryParser at the moment, everything is in the constructor while testing so please forgive me that.
public class QueryRunner
{
const string INDEX_FILE = "c:\\temp\\lucene\\lugen.index";
string _queryString = null;
public QueryRunner(string queryString)
{
_queryString = queryString;

var dir = Lucene.Net.Store.FSDirectory.GetDirectory(INDEX_FILE, false);
var reader = Lucene.Net.Index.IndexReader.Open(dir);
var searcher = new Lucene.Net.Search.IndexSearcher(reader);
Lucene.Net.QueryParsers.QueryParser parser = new Lucene.Net.QueryParsers.QueryParser("defaultField", new CustomFieldAnalyzer());
var query = parser.Parse(_queryString);
var hits = searcher.Search(query);
}
}


Reply via email to