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?
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.
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
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.
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...
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
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
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.
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
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.
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...
Thanks Shannon! I'll take a look,
is working on a reply...