MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

Search functionality  (Mono Support )

24090 put(a) pogledan, 4 odgovor(a) 15.11.2013. 0:45:52Kreirao(la) mmorozov

Povezane teme

mmorozov

mmorozov

15.11.2013. 0:45:52
In the current search implementation, I often get a timeout even with Full-Text search configured.  And it looks like the search scope is "All discussions". Is there a way to limit the search scope to a specific discussion board or even a specific topic?

Another interesting feature is to search only in the posts of people who I list as friends. When the community grows, the search results return a lot of noise. 
Ovaj sadržaj još nije ocijenjen. 
95 Reputacija 10 Ukupno objava
khorvat

khorvat

19.11.2013. 11:19:15
Hi,

you can do the following in order to accomplish what you need:

1. You will need to add a separate search WebPart (MonoXSearchBoxWithFilter.ascx - "Filtered site search") and setup the search with only "DiscussionSearchProvider" like this:
<MonoX:Search ID="search1" runat="server" Title='<%$ Code: PageResources.Title_SearchResults %>'>
    <SearchProviderItems>                               
        <Search:SearchProviderItem Name="DiscussionSearchProviderOnlyBoard" Template="Default"></Search:SearchProviderItem>
    </SearchProviderItems>
</MonoX:Search>
2. "Is there a way to limit the search scope to a specific discussion board or even a specific topic? " In order to filter out only Boards or Topics or Messages you can register another discussion search provider of the same type in the web.config but with different setup. You will need to set it similar to this:

<add name="DiscussionSearchProviderOnlyBoard" type="MonoSoftware.MonoX.SearchEngine.Providers.DiscussionSearchProvider, MonoX" DiscussionDescriptionLength="255" BoldSearchPhrases="true" FullTextSearch="false" MaxNoOfResults="100" SearchBoards="true" SearchTopics="false" SearchMessages="false"/>
DiscussionSearchProvider.SearchBoards
DiscussionSearchProvider.SearchTopics
DiscussionSearchProvider.SearchMessages

3. To filter by specific board you will need to inherit the DiscussionSearchProvider and override a few methods

/// <summary>
/// Initialize message filter.
/// </summary>
/// <param name="filter">Filter.</param>
protected virtual void InitMessageFilter(RelationPredicateBucket filter)
 
/// <summary>
/// Initialize topic filter.
/// </summary>
/// <param name="filter">Filter.</param>
protected virtual void InitTopicFilter(RelationPredicateBucket filter)
 
/// <summary>
/// Initialize board filter.
/// </summary>
/// <param name="filter">Filter.</param>
protected virtual void InitBoardFilter(RelationPredicateBucket filter)
and you will need to add the following line of code to filter:

/// <summary>
/// Initialize board filter.
/// </summary>
/// <param name="filter">Filter.</param>
protected override void InitBoardFilter(RelationPredicateBucket filter)
{
    base.InitBoardFilter(filter);
    if (UrlParams.EntityId.HasValue)
        filter.PredicateExpression.Add(SnDiscussionBoardFields.Id == UrlParams.EntityId.Value);
}
and do the same for Topics and Messages if you want to filter by them.

Let us know if you need more help with this.

Regards
Ovaj sadržaj još nije ocijenjen. 
15993 Reputacija 2214 Ukupno objava
Kezber

Kezber

2.9.2015. 20:11:33

Speaking of search engines; is there a tutorial or a walkthrough for adding additional search Providers ?

Thanks

Ovaj sadržaj još nije ocijenjen. 
215 Reputacija 29 Ukupno objava
khorvat

khorvat

3.9.2015. 8:54:42
Hi,

there is no walk through but you can find more info on forums and we have just open sourced a CalendarEvent search provider on GitHub so you can try to implement your own using that sample.

https://github.com/MonoSoftware/MonoX-CalendarEvent-SearchProvider

http://monox.mono-software.com/Mono/Pages/Discussion/dtopic/0NlQSWbliEq4HKBNAVYFYQ/Custom-MonoX-Search-Provider/

BTW can you please open a new topic rather then hijacking 2 years old topic :)

Regards
Ovaj sadržaj još nije ocijenjen. 
15993 Reputacija 2214 Ukupno objava