On Jun 16, 2004, at 7:25 AM, [EMAIL PROTECTED] wrote:


Well, I just didn't want to overload people with too much code.

There is an art to providing just enough detail :)

doc is created like this ("modified" get formated with SimpleDateFormat
tformat = new SimpleDateFormat ("yyyyMMddhhmmss") by cashToIndex metod,
where the IndexWriter created) :

doc.add(Field.Keyword("modified",DateField.timeToString(modified)));


This looks fine.

formated_query=query.toString();
if (sort_byscore)hits = ms.search(query);
else hits = ms.search(query,new Sort("modified",true));
// here the "cannot determine.." exception generated!!!

How about using:

        ms.search(query,
           new Sort(new SortField("modified", SortField.STRING, true)));

Does that fix it?

If "modified" is only there for sorting and not for querying, perhaps index it as a Integer.toString or Float.toString instead - this will give you better resource usage and performance most likely - and change the type to SortField.INT or SortField.FLOAT appropriately. The sorting infrastructure can detect a type, but it may have issues doing so if the strings look like a number in the first document but later appear like a String. DateField.timeToString makes them String, so forcing it to sort on String type should work.

        Erik


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to