Title Back Colour Keyoti Title Line Title Curve
Blue Box Top

Display documents but avoid the path to be in the results - SearchUnit - Forum

Welcome Guest Search | Active Topics | Log In | Register

Options
danielvbdash
#1 Posted : Friday, February 20, 2015 8:25:54 PM
Rank: Member

Groups: Registered

Joined: 1/14/2015
Posts: 12
Hello

I would like to know how to exclude the path but keep the documents from this path to be displayed.

For example:

Given the following structure:
Path: "/results/important/"
Files: "/results/important/Schedule.pdf"
Files: "/results/important/FileNumber2.pdf"
Files: "/results/important/FileNumber3.pdf"

If I search for 'filenumber', in the results I get:
"/results/important/"
"/results/important/FileNumber2.pdf"
"/results/important/FileNumber3.pdf"

But, I don't want to display the path result, just the documents. How can I do that?

Thanks in advance.
Jim
#2 Posted : Friday, February 20, 2015 9:29:20 PM
Rank: Advanced Member

Groups: Administrators, Registered

Joined: 8/13/2004
Posts: 2,669
Location: Canada
If you visit "/results/important/" in a browser, it will presumably show either a directory list of files, or default.aspx or index.htm or something like that? Does that page have "filenumber" on it? That's why that link is coming up.

You can filter it out with http://keyoti.com/produc...Filtering%20Results.htm

Code:

protected void Page_Load(object sender, EventArgs e)
    {
        SearchResult1.FilterLoadLevel = Keyoti.SearchEngine.Search.FilterLoadLevel.Everything;
        SearchResult1.Configuration.CentralEventDispatcher.Action += new
        Keyoti.SearchEngine.Events.ActionEventHandler(CentralEventDispatcher_Action);
    }

    void CentralEventDispatcher_Action(object sender, Keyoti.SearchEngine.Events.ActionEventArgs e)
    {
        if (e.ActionData.Name == Keyoti.SearchEngine.Events.ActionName.ResultItemsFinalized)
        {
            Keyoti.SearchEngine.Utils.ResultItemList results =
                    e.ActionData.Data as Keyoti.SearchEngine.Utils.ResultItemList;
            for (int i = 0; i < results.Count; i++)
            {
              [b]  if (results[i].Title.EndsWith("/"))[/b]
                {
                    results.RemoveAt(i);
                    i--;//need to rerun over this element number.
                }
            }
        }
    }

-your feedback is helpful to other users, thank you!


danielvbdash
#3 Posted : Friday, February 27, 2015 2:32:29 AM
Rank: Member

Groups: Registered

Joined: 1/14/2015
Posts: 12
Hello Jim,

Thank you, it worked pretty well.

:)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.




About | Contact | Site Map | Privacy Policy

Copyright © 2002- Keyoti Inc.