From eea18f9c821771b620a76ccc647de1a37941f397 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Michael=20O=2E=20Hegg=C3=B8?= <danmichaelo@gmail.com>
Date: Mon, 27 Jul 2015 01:58:54 +0200
Subject: [PATCH] [#92] Don't explicitly set srwhat default

Since CirrusSearch (and Lucene?) doesn't support 'title'.
---
 mwclient/client.py | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/mwclient/client.py b/mwclient/client.py
index 74e6d40..1c19335 100644
--- a/mwclient/client.py
+++ b/mwclient/client.py
@@ -673,7 +673,28 @@ class Site(object):
                                                    toponly='1' if toponly else None))
         return listing.List(self, 'recentchanges', 'rc', limit=limit, **kwargs)
 
-    def search(self, search, namespace='0', what='title', redirects=False, limit=None):
+    def search(self, search, namespace='0', what=None, redirects=False, limit=None):
+        """
+        Perform a full text search.
+        API doc: https://www.mediawiki.org/wiki/API:Search
+
+            >>> for result in site.search('prefix:Template:Citation/'):
+            ...     print(result.get('title'))
+
+        Args:
+            search (str): The query string
+            namespace (int): The namespace to search (default: 0)
+            what (str): Search scope: 'text' for fulltext, or 'title' for titles only.
+                        Depending on the search backend, both options may not be available.
+                        For instance
+                        `CirrusSearch <https://www.mediawiki.org/wiki/Help:CirrusSearch>`_
+                        doesn't support 'title', but instead provides an "intitle:"
+                        query string filter.
+            redirects (bool): Include redirect pages in the search (option removed in MediaWiki 1.23).
+
+        Returns:
+            mwclient.listings.List: Search results iterator
+        """
 
         kwargs = dict(listing.List.generate_kwargs('sr', search=search, namespace=namespace, what=what))
         if redirects:
-- 
GitLab