The query contained only ignored words

Posted on 2007-10-03
Last Modified: 2012-05-05
I am using .NET to query indexing server (search engine for our Intranet)
If the user searches for "the" or "a" etc they will get an error page stating - The query contained only ignored words.
What is the best way to catch this and deliver something meaningful back to the page. I'd rather do this than have a huge array of ignored words (noise) to compare against.
Question by:QPR
    LVL 2

    Accepted Solution

        Do what you're doing
    Catch ex as Exception
       Response.Redirect("the page you're on")
    End Try
    LVL 29

    Author Comment

    Is there a way to echo to the user what they have done wrong so they can be educated.
    If I just use a generic catch ex then the message I relay may have nothing to do with what they have done (on this occasion)
    LVL 2

    Expert Comment

    An easy way would be to do a redirect to the page that you're on, with some information .. for example... Response.Redirect("ThePage.aspx?error=You pressed the wrong button")

    Then on that page, in the onload section.  You can set a variable or a text on that page to display the error.

    something like,
    ' This retrieves the error message
    Dim error as string = httpcontext.current.request.querystring("error").trim

    ' This creates a textbox and inserts it onto the aspx page.  you can create just about anything to insert on your page with the error message.  It can be a DIV, Span, html link, anything..  Here i'm using a textbox

    If Not string.isnullorempty(error) Then
     Dim errorTextBox as New TextBox
     With errorTextBox
         .Text = error
        ' Do other things to format this message here
     End With
     ' Pick a control such as a DIV, SPAN, or Asp Panel with an ID on your aspx page  that runs on the server
      'Do Nothing
    End If
    LVL 29

    Author Comment

    Thanks but I want (if possible) to be able to catch that particular error (the one in the question). I have no problem redirecting in the catch block. But I can't guaruantee that the error will always be that one.
    Example if the person searches for "a valid phrase" and, for some reason, the IS service is not running... the error would be indexing service is currently available but I would be telling the user there search string is invalid leaving them confused and unlikely to use the search function.
    LVL 2

    Expert Comment

    you will have to trap that particular error then.

    do you know what error it throws?  If you do, then you can catch it. I'm assuming that the error is thrown and page is redirected based on a sql statement or error of some sort.

    You don't have to manually create a dictionary to check it against if you know how it is checking this.  

    Of if you must, put all of those words into a sql table and just do a sql querry against it.

    See if you can trap and print the error.  Once you know more details of the error, you can better trap it.
    LVL 29

    Author Comment

    The error comes from indexing server (which is what I am querying) there is not redirection just a .net error page, if I were to turn on custon errors (which I will when we go live) then the user would just see internet explorer cannot display this page etc. When back at work later I will check for error numbers. The text for the error is.... The query contained only ignored words
    LVL 2

    Expert Comment

    So if you put that query inside a try block, it still won't catch anything?  If you can catch it, try to echo the error.

    If not, then you will have to understand how the index server is processing this information and go from there.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Suggested Solutions

    In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now