/** * Returns a collection of current search jobs. * * @param args Collection arguments that specify the number of entities to * return and how to sort them. See {@link CollectionArgs}. * @return A collection of search jobs. */ public JobCollection getJobs(Args args) { return new JobCollection(this, args); }
/** * Creates a search with a UTF8 pre-encoded search request. * <p> * <b>Note:</b> You can't create a "oneshot" search using this method. * Instead, use the {@link Service#oneshotSearch} method. * * @param query The search query. * @return The unique search identifier (SID). */ public Job create(String query) { return create(query, (Map)null); }
var jobs = new JobCollection(): jobs.fetch({success: function(collection, resp, opts){ console.log(collection.get('7a107f87-be69-5efa-107c-c045e75940cf'')); });
/** * Creates a search. * <p> * <b>Note:</b> You can't create a "oneshot" search using this method. * Instead, use the {@link Service#oneshotSearch} method. * * @param query The search query. * @param args Additional arguments for this job (see {@link JobArgs}). * @return The unique search identifier (SID) for the job. */ // NOTE: This overload exists primarily to provide better documentation // for the "args" parameter. public Job create(String query, JobArgs args) { return this.create(query, (Map<String, Object>) args); }
// Implement our collections, views, etc var jobCollection = new JobCollection(); var jobsView = new JobsView(); var filterView = new FilterView().render(); // Add listeners on our view filterView.on("submit", updateJobs); // Implement the functions for our view (this can be done in a number of ways) function updateJobs(query) { jobCollection.fetch({ data: { query: query } }).done(function(response) { // Technically you could just provide "jobsView.render" to the done() method, but I wanted to be a little more verbose here regarding parameters jobsView.render(response); }); }
/** * Creates an asynchronous search job using the given query and * search arguments. * * @param query The search query. * @param args The search arguments. * @return The search job. */ public Job search(String query, Map<String, Object> args) { args = Args.create(args); return this.getJobs().create(query, args); }