: So far this seems acceptable. Query performance seems fine when using
: the dynamic fields to sort result sets; indexing performance also
: seems fine*. That said, there are only 400K documents in the
: collection I'm working with, and few external rating sources at the
: moment (there are about a dozen, and most documents have no external
: ratings data associated with them). But as these fields will be
: created from user-generated data, there's nothing to stop those
: numbers from ballooning.

the biggest factor to worry about is the number of "sources" ... the key 
to understanidng the performance risks is to understand that:
  1) no matter how many documents do or don't have a value for a given 
field, when you sort on thta field, a (cached) array containing one 
element for *every* doc in your index is used for that field.
  2) sorting dynamic fields is no differnet then sorting regular fields.

...so if you've got three sources, and from each source you get a 
"userRatingAvg" and a "userRatingSum" and you want to sort on them, it 
doesn't matter if you create 6 distinct fields, or two dynamic fields; and 
it doesn't matter if only 5 of your 400K docs have values for any one of 
those fields -- An array of 400K entires is going to be created for each 
of those fields the first time you sort on it with each "newSearcher"

as long as you've got the ram ... add as many 
sources/dynamicFields/documents as you want :)


-Hoss

Reply via email to