Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Kostadin 6 posts 26 karma points
    Mar 31, 2010 @ 08:48
    Kostadin
    0

    How to implement search with SQL Server full text catalog without or with minumum XSLTs ?

    Hi Guys,

    I am building a site in Umbraco (this is my first site) and I have to implement something like very simple product shop.

    So I have a paged listing page where the user sees all products with a summary. When the user clicks on a product the details view of that product with more info is shown. I am not a big fan of XSLT's for complicated logic so I have built my own tables to store information about the products and I have built my own CMS UI to enter that information. I am planning to provide a link from within Umbraco (something next to say development at your bottom left) to show my simple CMS page.

    So now the question:

    I need to implement a search for the website but a slightly more sofisticated search: The user sees a search textbox and a combobox with categories so that he/she can search only within a particular product categoy and not neccessarily the whole site. When the user does a search he/she is redirected to page where the results are shown but are organized into categories something like this:

    Bags Category

           Red bag - This is a nice bag buy it now ... more

    Hats Category

          Blue lady's har - This is an extremely  nice ... more

    etc.

    Any hints on how to best implemnt that search with C# and SQL Sever Full Text catalog will be great.

    I looked at the Lucene + XSLT searches implemented and I find them extremely diffcult so I am definately going to avaoid that.

    And another question that I have is: The implementation that I made smells to me. I mean having to built a CMS to handle my products kind of defies the purpose of using a CMS so if I used umbraco to enter product information how should I have went to create my listing page user control and details view user control with C#, again no XSLT's please. The problem is I do not see how to extract the content I need from Umbraco from within C# all examples show you how you get some xml and then use a complicated XSLT to transform that into your pages.While building my own tables to store that information allows me to access it in say the following way: SELECT ProductSummary,ProductId,ImageUrl FROM PRODUCT. Is there any API that I can use to achieve the same result (query that information from the umbraco storage) ?

    Thank you very much for your answers.

    Regards,

    kzmp

     

  • Kostadin 6 posts 26 karma points
    Apr 01, 2010 @ 23:02
    Kostadin
    0

    Hi again,

    Leaving this question without an anser made me think and I am comming to realize that I might be doing something wrong.

    So now I am thinking to dump my separate cms and use the umbraco API to access the content and use Umbraco Examine for the search and maybe write a custom indexer and provider to use SQL Server full text catalog instead of lucene.

    Does that sound more right than what I was doing ?

    Any hints or help on the full text catalog search would be appreciated.

     

    Regards,

    kzmp

  • Kostadin 6 posts 26 karma points
    Apr 02, 2010 @ 12:48
    Kostadin
    0

    OK ok,

    I have made some progress thanks to the projects UmbSearch2 and UmbracoExamine.

    So I went for creating an EventHandler and subscribed for the two events:  Document.AfterPublish and Document.AfterUnPublish.

    On AfterPublish I index on AfterUnPublish I delete the data from the indexed table.

    The problem now is that I have a page with a macro which is a usercontrol. On that usercontrol there is also some text that I would like indexed. Is it possible to somehow get that text. I am currently doing this:

     public static void Index(umbraco.cms.businesslogic.web.Document node)
            {
                // nodes that are marked hide from searching shouldn't be indexed
                if (node.getProperty("umbracoSearchHide") != null)
                {
                    int v = 0;
                    int.TryParse(node.getProperty("umbracoSearchHide").Value.ToString(), out v);
                    if (v == 1)
                    {
                        IndexerDA.DeleteNodeText(node.Id, IndexCategory.Generic);
                        return;
                    }
                }

                StringBuilder sb = new StringBuilder();
                foreach (Property p in node.getProperties)
                {
                    sb.AppendLine(umbraco.library.StripHtml(p.Value.ToString()));
                }

                if (!IndexerDA.UpdateNodeText(node.Id, sb.ToString(), IndexCategory.Generic))
                {
                    IndexerDA.CreateNodeText(node.Id, sb.ToString(), IndexCategory.Generic);
                }
            }

    The problem is that in my StringBuilder with the content I would like indexet I get the macro tag <?MACRO .../> but I want to get the text the usercontrol contains there. Do you think that that is possible ?

    Regards,

    Kostadin

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies