static void
nautilus_search_engine_beagle_start (NautilusSearchEngine *engine)
{
	NautilusSearchEngineBeagle *beagle;
	GError *error;
	GList *mimetypes, *l;
	char *text, *mimetype;

	error = NULL;
	beagle = NAUTILUS_SEARCH_ENGINE_BEAGLE (engine);

	if (beagle->details->current_query) {
		return;
	}

	beagle->details->query_finished = FALSE;
	beagle->details->current_query = beagle_query_new ();
	g_signal_connect (beagle->details->current_query,
			  "hits-added", G_CALLBACK (beagle_hits_added), engine);
	g_signal_connect (beagle->details->current_query,
			  "hits-subtracted", G_CALLBACK (beagle_hits_subtracted), engine);
	g_signal_connect (beagle->details->current_query,
			  "finished", G_CALLBACK (beagle_finished), engine);
	g_signal_connect (beagle->details->current_query,
			  "error", G_CALLBACK (beagle_error), engine);

	/* We only want files */
	beagle_query_add_text (beagle->details->current_query," type:File");
				   
	beagle_query_set_max_hits (beagle->details->current_query,
				   1000);
	
	text = nautilus_query_get_text (beagle->details->query);
	beagle_query_add_text (beagle->details->current_query,
			       text);

	mimetypes = nautilus_query_get_mime_types (beagle->details->query);
	for (l = mimetypes; l != NULL; l = l->next) {
		char* temp;
		mimetype = l->data;
		temp = g_strconcat (" mimetype:", mimetype, NULL);
		beagle_query_add_text (beagle->details->current_query,temp);
		g_free (temp);
	}

	beagle->details->current_query_uri_prefix = nautilus_query_get_location (beagle->details->query);
	
	if (!beagle_client_send_request_async (beagle->details->client,
					       BEAGLE_REQUEST (beagle->details->current_query), &error)) {
		nautilus_search_engine_error (engine, error->message);
		g_error_free (error);
	}

	/* These must live during the lifetime of the query */
	g_free (text);
	eel_g_list_free_deep (mimetypes);
}
static gboolean
rejilla_search_beagle_query_start (RejillaSearchEngine *search)
{
	RejillaSearchBeaglePrivate *priv;
	GError *error = NULL;

	priv = REJILLA_SEARCH_BEAGLE_PRIVATE (search);

	/* search itself */
	if (!priv->query) {
		g_warning ("No query");
		return FALSE;
	}

	beagle_query_set_max_hits (priv->query, 10000);
	g_signal_connect (G_OBJECT (priv->query), "hits-added",
			  G_CALLBACK (rejilla_search_beagle_hit_added_cb),
			  search);
	g_signal_connect (G_OBJECT (priv->query), "hits-subtracted",
			  G_CALLBACK
			  (rejilla_search_beagle_hit_substracted_cb),
			  search);
	g_signal_connect (G_OBJECT (priv->query), "finished",
			  G_CALLBACK (rejilla_search_beagle_finished_cb),
			  search);
	g_signal_connect (G_OBJECT (priv->query), "error",
			  G_CALLBACK (rejilla_search_beagle_error_cb),
			  search);

	beagle_client_send_request_async (priv->client,
					  BEAGLE_REQUEST (priv->query),
					  &error);
	if (error) {
		rejilla_search_engine_query_error (REJILLA_SEARCH_ENGINE (search), error);
		g_error_free (error);
		return FALSE;
	}

	return TRUE;
}