On Jan 31, 2011, at 10:51 , Azhar Jassal wrote: > How can I use Lucene to sort search results by the number of fields each > document has? (highest to lowest - documents with more fields in my index > are better results)
When you know you need to query on something you have available during indexing time, make your life easy and index it! In other words, index the number of (other) fields as a numeric into a "num_fields" field or something like that. This could be done automatically if you were to write a custom update processor and add it to the update processing chain, but easy enough to do in most custom indexers I've ever come across as well. > Also my fields are named as URI's i.e. "< > http://www.w3.org/2000/01/rdf-schema#label>", how should I form queries with > field names containing such syntax? How shall I pass them in, escaped? Good luck on this one... you'll have to contend with escaping (with a backslash) if you're using the "lucene" query parser, and perhaps other related headaches with other query parsers depending on how they do their thing underneath. Erik --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org