Make a Lucene field sortable and searchable
The java code snippet below will add searchable (TOKENIZED) fields and
sortable (UN_TOKENIZED) fields to a Lucene document.
if (value != null)
{
doc.add(new Field(key, value, Field.Store.YES, Field.Index.TOKENIZED));
if (key.equalsIgnoreCase("author") || key.equalsIgnoreCase("title") || key.equalsIgnoreCase("date") )
{
doc.add(new Field(key + "_sortable", value, Field.Store.YES, Field.Index.UN_TOKENIZED));
}
}
This is from the ag econ project file:
./src/org/dspace/search/DSIndexer.java