Complex Query - Using retrieved documents for secondary query

(dkullmann) #1


I have one index with documents that represent property listings. My
application finds property listings and provides visitors with
information about how each property compares to similar properties

For example, let's say the user performed a search and these documents
were returned:

For the first document with id '10526-pace-ave-los-angeles-ca-90002' I
would find similar properties that are nearby. A simple formula is
used to find nearby properties that are also similar:

  1. Restrict the geo_distance to 1 mile from 10526-pace-ave-los-angeles-
  2. Only include properties with an equal number of bedrooms of the
    10526-pace-ave-los-angeles-ca-90002 document
  3. Only include properties with +/- 1 bathroom of the 10526-pace-ave-
    los-angeles-ca-90002 document
  4. Only include properties with +/- 10% square footage of the 10526-
    pace-ave-los-angeles-ca-90002 document

The second search only needs to return summary information, such as
the average ListPrice for the found properties.

The same is repeated for all other documents ('10526-de-soto-avenue-
chatsworth-ca-91311', etc.) so that each document has this

Right now if I do a primary search and it returns 20 documents, I have
to do 20 additional searches for the similar properties. Is there a
way to combine all of this into one request, perhaps using scripting
or a more complex search?


(system) #2