Manybubbles has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/106265


Change subject: Don't ever ever search for nothing
......................................................................

Don't ever ever search for nothing

So long as the user actually adds a string to the search we'll search.  Even
if their string just ends up adding a filter.  That is cool.  We just
don't want to search when that box is empty.  That takes a long time because
we score most documents in the index and then throw them away because the
user was just looking to load the page.

Change-Id: I54b0cefe6ec052ade39c56440455bea274b06090
---
M includes/CirrusSearch.php
1 file changed, 6 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch 
refs/changes/65/106265/1

diff --git a/includes/CirrusSearch.php b/includes/CirrusSearch.php
index 3c569bf..463939b 100644
--- a/includes/CirrusSearch.php
+++ b/includes/CirrusSearch.php
@@ -53,6 +53,12 @@
         * @return ResultSet|null|Status results, no results, or error 
respectively
         */
        public function searchText( $term ) {
+               $term = trim( $term );
+               // No searching for nothing!  That takes forever!
+               if ( !$term ) {
+                       return null;
+               }
+
                $searcher = new Searcher( $this->offset, $this->limit, 
$this->namespaces );
 
                // Ignore leading ~ because it is used to force displaying 
search results but not to effect them

-- 
To view, visit https://gerrit.wikimedia.org/r/106265
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I54b0cefe6ec052ade39c56440455bea274b06090
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: Manybubbles <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to