Jump to content

Streamlined Quick Search


Dominic

Recommended Posts

I use the intelligent search feature, we have added it to every page

How have you done that ? The "presentation" of it's not great, but it does seem a useful thing, and I'd tried to add it to the "navbar" so it was available on every page with

<span class="navbutton">
<strong>Find:</strong>
<input type="text" name="intellisearchval" id="intellisearchval" onKeyUp="run_query();" style="width:120px;" />
<a href="#" onclick="document.getElementById('intellisearchval').value='';document.getElementById('searchresults').style.display='none';return false">
<img src="images/delete.gif" align="absmiddle" border="0" />
</a>
<div align="left" id="searchresults" style="border:2px solid #DFDCCE;background-color:#F7F7F2;padding:15px;margin-right:10px;display:none;" nowrap></div>
</div>
</span>

which whilst its *displayed* everywhere, it only works on the HOME Admin-Dashboard page, as that appears to be the only file in WHMCS with the requisite search code

Link to comment
Share on other sites

We are implementing a quick search function from our intranet that hooks into WHMCS amongst other systems. The search does SQL queries on the database rather than using the API.

 

I'm somewhat curious why most of the fields in the databases are text, rather than varchar.

 

The performance of the database would be significantly superior if fields were varchar and indexed. I realize we can in fact make these changes if we like, without impacting WHMCS itself. None the less, I'm curious why text was chosen.

 

To illustrate what I'm talking about, here are some queries I ran before and after changing to varchar and indexing.

 

With lastname as text;

EXPLAIN SELECT tblclients.* FROM tblclients WHERE tblclients.lastname LIKE 'Davis%' returns a search on all records. Creating a full text index on the text field doesn’t help.

 

Changing lastname to varchar(80) reduces the number of rows searched to 17. Doing slightly more complex queries such as

SELECT tblclients.* FROM tblclients WHERE tblclients.firstname LIKE 'S%' AND tblclients.lastname LIKE 'D%' reduces records searched to 131 with a result set of 43 records.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated