• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 393
  • Last Modified:

An intelligent Search function

I'd like to implement a search function on my site that let's people enter their question and then selects the best answer, from those I've put into my database,  according to which of the answers contains the most words from the question.   At least that would be an initial approach to it.

I'm striving for a certain amount of artificial intelligence here so I'm thinking that there may be programs, modules, techniques, etc. already out there that will take this a step farther and make a decision based on criteria more sophisticated than which answer contains the most words from the question. If I can capture the query the user entered into the search engine to reach my page, I could perhaps get some extra context from that.

Thanks for any ideas.
Steve
0
steva
Asked:
steva
  • 3
  • 3
2 Solutions
 
Ray PaseurCommented:
Google has kind of got this one figured out.  Consider using Google Site Search and Google Analytics.
0
 
Mark BradyCommented:
or if you wanted to try doing this yourself (more fun sometimes) here's how I would tackle it.

1: Do a query to get all of the questions you have in the table.
2: For each result (each question returned), explode it into an array by exploding it at a space ' '

ie:
$questions = array();
$result = mysql_query('SELECT `question` FROM `questions`') or die(mysql_error());
while ($row = mysql_fetch_assoc($result)) {

    $temp = explode(' ', $row['question']); // now you have an array or words for this question
    array_push($questions, $temp);
}

Open in new window


Now you have an array of words you can search.
Loop through that array with a foreach($questions AS $word) loop and you can compare how many of the words in each sub array (the words from each question) match the words in the submitted question. You can do it easily by assigning a variable as 0 then adding 1 to it each time a match is found.

Do you get the general idea?  If you don't follow me I can write something for you but I hope you can work it out based on the ideas above.
0
 
stevaAuthor Commented:
elvin66,

Yes, I follow you.  Thanks.  I'm thinking now, though,  that I'll need to do a bit more than count word matches.  See below, for example, for the importance of a "How do I" at the beginning of a visitor's question. I think I'm going to have to look at phrases as well as words to grasp the visitors meaning.


Ray,

I played with Google Site Search a bit but it doesn't seem to be what I want.  First, it returns all the pieces of text from the site that "match" so you typically  get four or five quotes back.  What I return needs to be THE answer to the question.

Second, it doesn't seem  that smart.  If I submit "how do I buy a barcode? " to a site that sells barcodes I get back all the places on the site that are yelling at me to "Buy a barcode! and nothing on How to buy a barcode.  (The "How do I"  visitor typically wants to know how many barcodes do they need for their products, do they have to register the barcodes, do they have to supply any information about their product for the barcode, etc." The "How" is critical to what the visitor wants to know but is lost on Google. Or Google may find "How" deeper in the text and think that helps the match.

You also mentioned Google Analytics. It's not clear to me how I would tap Google Analytics on the fly to help me answer this visitor's question. What was your thought here?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Ray PaseurCommented:
Please post the URL again.  I'll test a search product I have and show you the output.

You might want to create a FAQ page.  

If Google is not finding things that you think should be intuitive, there may be something that can be sharpened with the structure and content of the web pages.  Once I see the generated HTML I may be able to offer some suggestions.  Google pays close attention to the page title tag, the meta description tag and the H1 tag on each page.  Thereafter, the algorithms look for meaningful strings in the meta keywords tag, and text nearer to the top of the page.

It's also important to check that the pages pass W3 validation.
0
 
stevaAuthor Commented:
Ray,

I'd rather not post actual sites here I'm associated with.  But you could submit "How do I [verb] ..."  to any site related to the verb  and see if your search product finds an actual answer to the question or just returns snatches that bark out the verb.  You could also let me know what the product is and I'll try it when I get something up and ready to test.

You might want to create a FAQ page.  

I have a FAQ.  What I'm dreaming of here is a step above that.  A FAQ requires the visitor to read through a bunch of questions that he doesn't have,  in order to find the closest to his question. This is a field that says "Ask a Question."  You type what you want to know and you get your answer.

By the way, what I'm trying to do is Google's goal also.  I recall Erik Schmidt commenting once on all the results it returned for your question. "That's a bug!  We should just return one result that answers exactly what you asked.  We're working toward that goal."  The difference between them and me is that they're trying to do it for all the possible questions in the world while I just want to do it for the questions relative to one site.
0
 
Ray PaseurCommented:
A FAQ requires the visitor to read through a bunch of questions...
That misses the point.  A well constructed FAQ page will interact with a search engine in ways that create search results that are highly relevant to the client's search.

I don't know why you would want to keep your site a secret, but suit yourself.  To see what I wanted to show you about your site, purchase the PRO version of the Zoom Indexer and spend a day learning to configure it.

All the best, ~Ray
0
 
stevaAuthor Commented:
Ray,

I've been using the free version of Zoom 6.0 for about a year and a half on one of my sites and it absolutely does the search function quite well.  As far as I can tell the Pro version has the same feature set as the free version but will just index more pages and more types (PDF, eg) of pages. My problem with using Zoom for what I want now is that It brings back a  Search Results Page full of entries, when I want THE best entry, and not formatted as a SERP but as a single attractive paragraph. Maybe I want too much.

Thanks for discussion.
Steve
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now