On Sat, 2005-12-10 at 10:46 +0000, mailing rhythmbox seani justemail net wrote: > > There was a discussion about having more powerful filters available > > earlier in the year[0]. That suggest more complex searches, allowing > you > > to specify "artist=X or album=Y" and the like. What you're > suggesting > > would be a lot simpler, and fairly trivial to implement. > > > > > [0]http://mail.gnome.org/archives/rhythmbox-devel/2005-April/msg00041.html > > > > What we found was that it covered 95% of the functionality required, > and the majority of people grasped it straight away and used it. It's > limited in comparison to RegEx or name/value pair searches but it > tends to produce false positives rather than miss out items you're > interested in. In an application where there's human intervention when > the results get back, that doesn't seem to matter. And as you say, > it's trivial to implement. Patch against CVS is attached (it will probably apply to 0.9.2 as well). I can't imagine anyone actually wanting to search for the | symbol, so this shouldn't have any negative effects. Cheers, James "Doc" Livingston -- You can lead an idiot to knowledge but you cannot make him think. You can, however, rectally insert the information, printed on stone tablets, using a sharpened poker. -- Nicolai in asr
Index: sources/rb-library-source.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/sources/rb-library-source.c,v
retrieving revision 1.137
diff -u -u -r1.137 rb-library-source.c
--- sources/rb-library-source.c 10 Dec 2005 12:08:25 -0000 1.137
+++ sources/rb-library-source.c 11 Dec 2005 11:01:04 -0000
@@ -1444,6 +1444,7 @@
GPtrArray *query;
RhythmDBEntryType entry_type;
+ /* type = SONG */
g_object_get (G_OBJECT (source), "entry-type", &entry_type, NULL);
query = rhythmdb_query_parse (source->priv->db,
RHYTHMDB_QUERY_PROP_EQUALS,
@@ -1451,25 +1452,50 @@
entry_type,
RHYTHMDB_QUERY_END);
- /* select where type="song"
- */
-
+ /* add search text */
if (source->priv->search_text) {
- GPtrArray *subquery = rhythmdb_query_parse (source->priv->db,
- RHYTHMDB_QUERY_PROP_LIKE,
- RHYTHMDB_PROP_SEARCH_MATCH,
- source->priv->search_text,
- RHYTHMDB_QUERY_END);
- rhythmdb_query_append (source->priv->db,
- query,
- RHYTHMDB_QUERY_SUBQUERY,
- subquery,
- RHYTHMDB_QUERY_END);
- /* select where type="song" and
- * (genre like "foo" or artist like "foo" or album like "foo")
- */
+ char **strv;
+
+ strv = g_strsplit (source->priv->search_text, "|", -1);
+
+ if (strv[1]) {
+ /* more than one section */
+ GPtrArray *subquery;
+ int i;
+
+ subquery = rhythmdb_query_parse (source->priv->db,
+ RHYTHMDB_QUERY_PROP_LIKE,
+ RHYTHMDB_PROP_SEARCH_MATCH,
+ strv[0],
+ RHYTHMDB_QUERY_END);
+ for (i = 1; strv[i]; i++) {
+ rhythmdb_query_append (source->priv->db,
+ subquery,
+ RHYTHMDB_QUERY_DISJUNCTION,
+ RHYTHMDB_QUERY_PROP_LIKE,
+ RHYTHMDB_PROP_SEARCH_MATCH,
+ strv[i],
+ RHYTHMDB_QUERY_END);
+ }
+
+ rhythmdb_query_append (source->priv->db,
+ query,
+ RHYTHMDB_QUERY_SUBQUERY,
+ subquery,
+ RHYTHMDB_QUERY_END);
+ } else {
+ /* only one section, don't need a subquery */
+ rhythmdb_query_append (source->priv->db,
+ query,
+ RHYTHMDB_QUERY_PROP_LIKE,
+ RHYTHMDB_PROP_SEARCH_MATCH,
+ strv[0],
+ RHYTHMDB_QUERY_END);
+ }
+ g_strfreev (strv);
}
+ /* add browser limits */
if (source->priv->selected_genres) {
if (source->priv->selected_genres->next == NULL)
rhythmdb_query_append (source->priv->db,
Attachment:
signature.asc
Description: This is a digitally signed message part