Hi Tom,
GitHub Pages (and Jekyll generally) is great - nothing better than
being able to blog in vim!
A couple of problems with the approach you laid out:
1) When you use the :text_fields block, you're performing raw boolean
logic on text fields, rather than a dismax fulltext search. So, only
documents for which the exact search phrase appears will match that
(the equivalent of the phrase being in quotes in a normal dismax
search). Generally using the text_fields block is going to give
unexpected results to those without a pretty deep understanding of the
way Lucene tokenization and boolean logic work.
2) Even assuming the text_fields bit works, you're finding all
documents who meet the restrictions (has a property note for the
company AND has a property note matching the keywords). However, what
you want is (has a property note for the company that matches the
keyword). The latter simply isn't possible if you're indexing Property
objects. When thinking about indexed documents, it's important to
conceptualize them as flat documents, even though the data in them may
come from relational structures. Incidentally, the CompanyProperty
idea I mentioned yesterday probably does map closely to the resource
pattern in your application - presumably when you display a property
to a given company, you're presenting basically the same thing (the
information about a property as it relates to a particular company).
Hope that helps!
Mat