Copied to clipboard

Flag this post as spam?

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


  • Dan Evans 631 posts 1018 karma points
    Sep 10, 2009 @ 00:31
    Dan Evans
    0

    Lucene search - excluding documents from results

    Hi

    We are using Lucene search to search site content and documents. We have several searches on the site that start at different root nodes.

    The main site search returns results from the entire site but i'd like to remove certain document types from the results.

    I realise that i can exclude doc types from the index itself but these doc types are needed for other searches so i just want to remove them from the results.

    I've tried doing this in the results XSLT but this messes up the page numbering and document count information as this is calculated before the results are returned to the XSLT.

    Is there any way to remove certain doc types from the results? Or even push them to the bottom of the list?

    The site is using Umbraco 3.0.5

    Thanks

    Dan

  • Thomas Höhler 1237 posts 1709 karma points MVP
    Sep 10, 2009 @ 09:03
    Thomas Höhler
    0

    You have to get the docTypeAlias into the index.

    Take a look in the great article from Dirk: http://www.netaddicts.be/articles/umbraco-and-lucenenet.aspx

    Or you can read all results as umbraco.presentation.nodeFactory.Node objects and get the nodetypealias from there.

    hth, Thomas

  • Dan Evans 631 posts 1018 karma points
    Sep 10, 2009 @ 11:40
    Dan Evans
    0

    Hi

    Yes, i saw that artice but it's more about the way the index works rather than the way the searcher displays results. Additionally the version of Lucene i'm using does return docType in the results (see below). 

    I can filter results by doc type quite easily in the XSLT - the problem is the paging and numbering is all handled by umbSearchResult.ascx which means that any docs filtered out by XSLT mess up the page numbering. If you reorder results based on doc type this also messes up the results.

    <node id="5052" version="1ff9c027-2ad4-47e7-afd1-ff2f11216c5c" parentID="4128" level="6" writerID="0" creatorID="0" nodeType="4112" template="4113" sortOrder="1191" createDate="2008-05-27T12:23:00" updateDate="2009-02-09T08:14:08" nodeName="bill doney" urlName="bill-doney" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="rbl_lost_trail" path="-1,1052,1079,5606,4116,4128,5052" score="12.91875"  />
  • Thomas Höhler 1237 posts 1709 karma points MVP
    Sep 10, 2009 @ 12:41
    Thomas Höhler
    0

    Ok, it seems that it is an output problem. Did you thought about some paging and sorting via jQuery? Output all results and let the sorting and paging do at the client

    BTW: Did you take a look into my Simple Search for Umbraco?

    There you can define which doctypes to search. Output is given for xslt and for controls

    hth,
    Thomas

  • Dan Evans 631 posts 1018 karma points
    Sep 10, 2009 @ 15:42
    Dan Evans
    0

    An XSLT search would be ideal but we need to search files as well which means using Lucene.

    I may have to look at paging sorting via JQuery but there is an inherent problem in that Lucene only returns a page at a time. I guess i could set the page size to 1000 and assume no more than 1000 results but this may be quite a large XML file to work with? I will give it a go.

     

     

  • Shannon Deminick 1530 posts 5278 karma points MVP 3x
    Sep 11, 2009 @ 01:35
    Shannon Deminick
    0

    You can use Umbraco Examine to do this:

    http://umbracoexamine.codeplex.com/

    The source is currently only supporting v4 + but the current release and some of the initial commits are compatible with version 3. It is very extensible and should do what you need it to do. You can define what types to include/exclude, what fields to include, define multiple indexes, event handlers, etc...

     

  • Dan Evans 631 posts 1018 karma points
    Sep 11, 2009 @ 09:50
    Dan Evans
    0

    Thanks Shannon! I'll take a look,

Please Sign in or register to post replies

Write your reply to:

Draft