You have to index the field 2 times with different names. One time for search (analyzed) and one time for sorting (not analyzed).
Uwe ----- Uwe Schindler H.-H.-Meier-Allee 63, D-28213 Bremen http://www.thetaphi.de eMail: u...@thetaphi.de > -----Original Message----- > From: johnbesel [mailto:johnbe...@web.de] > Sent: Saturday, January 19, 2013 10:55 AM > To: general@lucene.apache.org > Subject: Indexer search with filter and sort > > Hello together, > > I work since 2 weeks with lucene and developed an application which put > some values into index and get it from it. > > it works very good. > > now I want to sort values, which I put into index. > I used a SortField to sort values: > new SortField(sortKey, SortField.STRING, SortDirection.DESC); > > It didn't work. > I found in internet that when I want to use a SortField with type String, I > should build Index with Index.NOT_ANALYZED. > (http://blog.richeton.com/2009/05/12/lucene-sort-tips/) > > I tested it, so now I could sort my values correct, BUT I could not search for > them :( > > How can I search and sort String values ???? > > thank you for your help. > > P.S. > I use StandardAnalyzer and Lucene 3.6. > I put values into index > doc.add(new Field(KEY_CUSTOMER_NUMBER, customer.getKunnr() != null ? > customer.getKunnr() : "", Store.YES, Index.ANALYZED)); > > > > > -- > View this message in context: http://lucene.472066.n3.nabble.com/Indexer- > search-with-filter-and-sort-tp4034733.html > Sent from the Lucene - General mailing list archive at Nabble.com.