A Google-like Full Text Search

  • Using irony with IIS

    I would guess that it is possible to incorporate the irony compiler as an assembly in IIS. My road block is finding a "how to" in order to set it up. It would be great to add this feature to some of our existing intranet searches. Anybody willing to provide step by step? 😀

  • Hi Michael,

    I am going to use irony-based query parser into webservice.

    I do not see any problem to do it.

    Regards,

    Oleg.

  • Ah Grasshopper

    Thanks for chiming in. I actually worked out the details of the assembly for the website. I will post the steps later as I think others may want to know how to do this.

    -Michael

  • michael.nathan.white (8/17/2009)


    Ah Grasshopper

    Thanks for chiming in. I actually worked out the details of the assembly for the website. I will post the steps later as I think others may want to know how to do this.

    -Michael

    Yes, exactly 😉

  • Just as a starting advice, for use in web server. Using Irony in any app involves some start-up time, when it builds parsing tables for particular grammar - search grammar in this case; it takes a few tens of milliseconds. This activitiy should probably performed once, at web app startup and then the result (LanguageData object) should be cashed in application-wide object for use in all incoming requests. This object is immutable, so sharing should be safe. In an incoming request, the code should instantiate parser object using shared LanguageData instance and then proceed to process the input string.

  • All issues are fixed in the latest Irony source drop (08/18). International chars are now supported, no confusion of prefixes with matching operators. Please test it with database - I didn't test the actual transformation method.

  • You can add (and replace existing) following lines to support all unicode characters:

    string additionalTermCharacters = "";

    //Add international (unicode) characters

    for (int i = 192; i < 512; i++)

    additionalTermCharacters += (char)i;

    // Terminals

    var Term = new IdentifierTerminal("Term", "!@#$%^*_'.?" + additionalTermCharacters, "!@#$%^*_'.?0123456789" + additionalTermCharacters);

  • I tried to compile it with newest Irony.

    I managed to fix errors due to methods change on Irony, but Grammar doesn't work.

    With just these changes (new Irony, and changed error handling) it gives me errors like Keyword is missing on start end...

    Did anyone tried to use newest Irony?

  • Use the SearchGrammar that is in Irony.Samples assembly in latest Irony sources

  • Sorry I've been out of the loop for a while. Thanks for the update Roman! If you don't mind I'll grab the newest Irony DLL and rebuild the sample with the updated grammar, and ask Steve to put the new code up as a download for this article. It might take me until the weekend to get to it, but I've got it on the radar.

    Thanks

    Mike C

  • developmentalmadness (10/15/2008)


    Very cool. It's exactly what I needed. I'm implementing a search and didn't want users to have to learn FTS syntax. Thanks for your work.

    I'm running into a problem with the OR operator. If I search for the term "orange" (no quotes in search, just for clarity here) I get the following error:

    Syntax error, expected: OrExpression AndExpression PrimaryExpression ThesaurusExpression ThesaurusOperator ExactExpression ExactOperator ParenthesizedExpression ProximityExpression OrExpression'

    If I search for "andes" (as in the mountains) I get the same error.

    I tried changing the value of OrOperator.Rule by adding a space after "or" like this:

    OrOperator.Rule = Symbol("or ") | "|";

    And it seems to work. So I did the same with "and". I'd be interesting in having this confirmed that I'm not misunderstanding how this works and thus causing problems.

    Just wanted to thank you for this easy fix. Worked like a charm for me.

  • Again, I would like to point out that all these troubles with "or" and "and" prefixes should be gone if you use the latest version of Irony. There is also one big improvement in latest code drop of Irony - you can now try/test the search query converter directly from the Grammar Explorer test page. Download and use it please - and enjoy it!

  • rivantsov (10/14/2009)


    Again, I would like to point out that all these troubles with "or" and "and" prefixes should be gone if you use the latest version of Irony. There is also one big improvement in latest code drop of Irony - you can now try/test the search query converter directly from the Grammar Explorer test page. Download and use it please - and enjoy it!

    I am using asp.net 2.0 with vs 2005. I was under the impression that the new stuff was 3.5.

    If I am wrong...great. Just did not want to break what is working for me.

  • If you you'd like to upgrade to the latest version of Irony, version 34726 Oct 13 2009, I did so with some code changes in Michael Coles code. The changes weren't major. In Irony, name spaces and method names were changed, so I updated Michael's code to reflect that.

    First I download Irony[/url] and used irony-34726\Irony.Samples\FullTextSearchQueryConverter\SearchGrammar.cs to replace SearchGrammar.cs in Michael's project.

    Next, (this is where my code will differ from Michael's, but you can follow it to make the needed changes) I had to change the way I called SearchGrammar. This is my code which you can use as a guide:

    using System;

    using System.Collections.Generic;

    using Irony.Parsing;

    using System.Data;

    namespace Ronnie

    {

    public class Search

    {

    private static Parser _parser;

    public static List<Ronnie.Link> DoSearch(string query) {

    Ronnie.SearchGrammar grammar = new Ronnie.SearchGrammar();

    if (_parser == null) _parser = new Parser(grammar);

    ParseTree root = _parser.Parse(query.ToLower());

    List<Ronnie.Link> links = new List<Ronnie.Link>();

    if (root.Errors.Count == 0)

    {

    query = Ronnie.SearchGrammar.ConvertQuery(root.Root, Ronnie.SearchGrammar.TermType.Inflectional);

    DataTable dt = Ronnie.Data.Search.Get(query);

    foreach (System.Data.DataRow dr in dt.Rows)

    {

    links.Add(new Ronnie.Link(dr));

    }

    }

    return links;

    }

    }

    }

  • While testing this against AdventureWorks, if I enter the complete text for title with a number for example Front Reflector Bracket and Reflector Assembly 3 it returns no results. Anything I am doing wrong?

Viewing 15 posts - 76 through 90 (of 166 total)

You must be logged in to reply to this topic. Login to reply