Title Back Colour Keyoti Title Line Title Curve
Blue Box Top

Custom results sorting - SearchUnit - Forum

Welcome Guest Search | Active Topics | Log In | Register

Options
DMacy
#1 Posted : Tuesday, October 18, 2022 8:56:47 PM
Rank: Advanced Member

Groups: Registered

Joined: 9/1/2010
Posts: 133
I'm trying to build a plugin to do custom results sorting. Here is a piece of it:

Code:

Public Sub DispatcherAction(ByVal sender As Object, ByVal e As ActionEventArgs)

  Select Case e.ActionData.Name
    Case ActionName.ResultItemsFinalized
      Dim ResultItems As Keyoti.SearchEngine.Utils.ResultItemList = CType(e.ActionData.Data, Keyoti.SearchEngine.Utils.ResultItemList)

      ResultItems.Sort(New DocumentComparer())
  End Select

End Sub


I'm getting the following error:

You attempted to access a property in ResultItem or DocumentRecord that has not been loaded. Please set the "FilterLoadLevel" property in SearchResult and/or SearchAgent to the any of these settings: Everything, and try again.

I don't know where to set FilterLoadLevel. I'm doing this in HTML and JavaScript, not VB.NET.
Jim
#2 Posted : Wednesday, October 19, 2022 8:37:48 PM
Rank: Advanced Member

Groups: Administrators, Registered

Joined: 8/13/2004
Posts: 2,667
Location: Canada
Ah, you're right, that isn't possible yet. I've added it for you, you can now do

Code:


        keyotiSearch.filterLoadLevel = 'DocIdUrlCategories';


or

Code:

        keyotiSearch.filterLoadLevel = 'Everything';


in JS in your search page.

The first is faster but might not give you everything you need, from the error I would say that you need the latter.

Please update the DLLs and JS file from here https://www.dropbox.com/t/Kt8XLeF3DuGIDaLR
-your feedback is helpful to other users, thank you!


DMacy
#3 Posted : Wednesday, October 19, 2022 8:44:27 PM
Rank: Advanced Member

Groups: Registered

Joined: 9/1/2010
Posts: 133
Thanks, Jim! I'll give it a try.
DMacy
#4 Posted : Friday, October 21, 2022 5:38:38 PM
Rank: Advanced Member

Groups: Registered

Joined: 9/1/2010
Posts: 133
That worked. Thanks!

In the action of ResultItemsFinalized, is it possible to filter specific items in the list and delete them before sorting?

Also, is there a way to tag specific result items with a CSS class or some other way to format individual items differently than the rest? For example, I might have three result items in a row that are similar and I want to indent the second and third items of the group more than the first.
Jim
#5 Posted : Friday, October 21, 2022 7:45:26 PM
Rank: Advanced Member

Groups: Administrators, Registered

Joined: 8/13/2004
Posts: 2,667
Location: Canada
>In the action of ResultItemsFinalized, is it possible to filter specific items in the list and delete them before sorting?

Yes, you can add/remove items from the list.

>Also, is there a way to tag specific result items with a CSS class or some other way to format individual items differently than the rest?

You could try setting an item in resultItem.CustomDataDictionary, eg. resultItem.CustomDataDictionary.Add( new KeyValuePaid("isSpecial", "true"));

and then see "Custom data dictionary fields" here https://keyoti.com/produ...0Usage/BasicSearch.html


So I think you would then be able to do this in your template (sorry I haven't tried this, but I think it is correct)

Code:

    <div id="sew_resultItemTEMPLATE" class="sew_resultItem">
        <p class="${CustomDataDictionary.isSpecialDisplayClass}">
            ***** <span class="sew_resultItemLink"><a href="${UriStringWithKeywords}">${Title}</a></span>
            <span class="sew_resultItemSummary">${Summary}</span>
        </p>
    </div>


and you will see that results where isSpecial is set the CSS class will be class="isSpecial" in the P tag, and when isSpecial is not set the class will be class="isSpecialNoContent"

So I think from there you can specify the isSpecial CSS class to look like you want.


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


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.