marklogic-community / eauser-geomapper

TEACUP: MarkLogic-based visualization of where early access users are from
Other
1 stars 4 forks source link

Refactor search.sjs to be able to combine industry, feature, and geo queries to find users. #79

Closed kmcostel closed 8 years ago

kmcostel commented 8 years ago

Need to use cts to combine queries, so switch jsearch searches with cts. queries

dmcassel commented 8 years ago

Why not something like this?

var users = 
  jsearch.facets([
      jsearch.facet('Industry', cts.jsonPropertyReference('industry')).orderBy('frequency', 'descending'),
      jsearch.facet('Feature', cts.jsonPropertyReference('features')).orderBy('frequency', 'descending'),
    ],
    jsearch.documents().map({extract:{select:'all'}})
  )
  .where(
    cts.andQuery([
      industryQuery,
      featureQuery,
      geoQuery
    ])
  )
  .result();

That lets the JSearch library handle the facet generation for you.