not sure if it's the most elegant solution, but you could add the field twice: one for searching, the other one for sorting...
On 17.05.2010, at 18:59, Jochen Kempf wrote: > Hi Robert! > > Thanks for that description. I noticed that once I use the keyword analyzer > I cannot use a wildcard search anymore. Is there any way to allow wildcard > search and sort on a text field? > > > 2010/5/17 Robert Newson <[email protected]> > >> You are attempting to sort on a field with text in, which Lucene does >> not support. You can prevent this exception by not doing that. :) >> >> Specifically, you've done something like ret.add(doc.subject, >> {"field":"subject"}) and then ?sort=subject >> >> Assuming I've guessed correctly, you can achieve this effect using the >> keyword analyzer (which will not break your 'subject' field into >> multiple tokens); add {"analyzer":"keyword"} when indexing that field. >> Note that the full value of 'subject' will be indexed, so you might >> wish to truncate it. >> >> B. >> >> On Mon, May 17, 2010 at 4:29 AM, Jochen Kempf <[email protected]> >> wrote: >>> Hi, >>> >>> how can I prevent the following exception? >>> >>> java.lang.RuntimeException: there are more terms than documents in field >>> "job", but it's impossible to sort on tokenized fields >>> >>
