beagle r4629 - in trunk/libbeagle: beagle wrappers/python
- From: dbera svn gnome org
- To: svn-commits-list gnome org
- Subject: beagle r4629 - in trunk/libbeagle: beagle wrappers/python
- Date: Fri, 21 Mar 2008 04:51:40 +0000 (GMT)
Author: dbera
Date: Fri Mar 21 04:51:39 2008
New Revision: 4629
URL: http://svn.gnome.org/viewvc/beagle?rev=4629&view=rev
Log:
Add the snippet parameters to libbeagle and python bindings.
Modified:
trunk/libbeagle/beagle/beagle-snippet-request.c
trunk/libbeagle/beagle/beagle-snippet-request.h
trunk/libbeagle/wrappers/python/beagle.defs
Modified: trunk/libbeagle/beagle/beagle-snippet-request.c
==============================================================================
--- trunk/libbeagle/beagle/beagle-snippet-request.c (original)
+++ trunk/libbeagle/beagle/beagle-snippet-request.c Fri Mar 21 04:51:39 2008
@@ -38,6 +38,8 @@
BeagleQuery *query;
BeagleHit *hit;
gboolean set_full_text;
+ gint ctx_length;
+ gint snp_length;
} BeagleSnippetRequestPrivate;
#define BEAGLE_SNIPPET_REQUEST_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), BEAGLE_TYPE_SNIPPET_REQUEST, BeagleSnippetRequestPrivate))
@@ -63,6 +65,9 @@
else
g_string_append (data, "<FullText>false</FullText>");
+ g_string_append_printf (data, "<ContextLength>%d</ContextLength>", priv->ctx_length);
+ g_string_append_printf (data, "<SnippetLength>%d</SnippetLength>", priv->snp_length);
+
_beagle_hit_to_xml (priv->hit, data);
g_string_append (data, "<QueryTerms>");
@@ -123,6 +128,8 @@
priv = BEAGLE_SNIPPET_REQUEST_GET_PRIVATE (snippet_request);
priv->set_full_text = FALSE;
+ priv->ctx_length = -1;
+ priv->snp_length = -1;
}
/**
@@ -195,7 +202,7 @@
/**
* beagle_snippet_request_set_full_text:
* @request: a #BeagleSnippetRequest
- * @query: boolean
+ * @full_text: boolean
*
* Request full cached text of this hit. The text will not be marked with search terms
* for performance reasons.
@@ -211,3 +218,41 @@
priv = BEAGLE_SNIPPET_REQUEST_GET_PRIVATE (request);
priv->set_full_text = full_text;
}
+
+/**
+ * beagle_snippet_request_set_context_length:
+ * @request: a #BeagleSnippetRequest
+ * @ctx_length: the number of context words
+ *
+ * Set the number of maximum number of words before or after the matching query term. The default value is 6.
+ **/
+void
+beagle_snippet_request_set_context_length (BeagleSnippetRequest *request,
+ gint ctx_length)
+{
+ BeagleSnippetRequestPrivate *priv;
+
+ g_return_if_fail (BEAGLE_IS_SNIPPET_REQUEST (request));
+
+ priv = BEAGLE_SNIPPET_REQUEST_GET_PRIVATE (request);
+ priv->ctx_length = ctx_length;
+}
+
+/**
+ * beagle_snippet_request_set_snippet_length:
+ * @request: a #BeagleSnippetRequest
+ * @snp_length: maximum length of the snippet
+ *
+ * Set the maximum number of characters for this snippet.
+ **/
+void
+beagle_snippet_request_set_snippet_length (BeagleSnippetRequest *request,
+ gint snp_length)
+{
+ BeagleSnippetRequestPrivate *priv;
+
+ g_return_if_fail (BEAGLE_IS_SNIPPET_REQUEST (request));
+
+ priv = BEAGLE_SNIPPET_REQUEST_GET_PRIVATE (request);
+ priv->snp_length = snp_length;
+}
Modified: trunk/libbeagle/beagle/beagle-snippet-request.h
==============================================================================
--- trunk/libbeagle/beagle/beagle-snippet-request.h (original)
+++ trunk/libbeagle/beagle/beagle-snippet-request.h Fri Mar 21 04:51:39 2008
@@ -61,5 +61,14 @@
void beagle_snippet_request_set_query (BeagleSnippetRequest *request,
BeagleQuery *query);
+void beagle_snippet_request_set_full_text (BeagleSnippetRequest *request,
+ gboolean full_text);
+
+void beagle_snippet_request_set_context_length (BeagleSnippetRequest *request,
+ gint ctx_length);
+
+void beagle_snippet_request_set_snippet_length (BeagleSnippetRequest *request,
+ gint snp_length);
+
#endif /* __BEAGLE_SNIPPET_REQUEST_H */
Modified: trunk/libbeagle/wrappers/python/beagle.defs
==============================================================================
--- trunk/libbeagle/wrappers/python/beagle.defs (original)
+++ trunk/libbeagle/wrappers/python/beagle.defs Fri Mar 21 04:51:39 2008
@@ -1457,6 +1457,24 @@
)
)
+(define-method set_context_length
+ (of-object "BeagleSnippetRequest")
+ (c-name "beagle_snippet_request_set_context_length")
+ (return-type "none")
+ (parameters
+ '("gint" "ctx_length")
+ )
+)
+
+(define-method set_snippet_length
+ (of-object "BeagleSnippetRequest")
+ (c-name "beagle_snippet_request_set_snippet_length")
+ (return-type "none")
+ (parameters
+ '("gint" "snp_length")
+ )
+)
+
(define-method set_query
(of-object "BeagleSnippetRequest")
(c-name "beagle_snippet_request_set_query")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]