+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Search: wordsMode (Any Word or All Words) doesn't work, but I need it

Search: wordsMode (Any Word or All Words) doesn't work, but I need it

2 posts, 0 answered
  1. LBrinley
    LBrinley avatar
    59 posts
    Registered:
    29 Dec 2005
    26 Dec 2013
    Link to this post
    I posted this as a bug in the Bugs/Issues forum, but I need help with search results honoring the "AllWords" and "AnyWord" enums (0 and 1, respectively).  Since the WordsMode property is not exposed in either the SearchBox or SearchResults widgets and the wordsMode querystring parameter has no effect, I assume I need to deal with this in my custom SearchBox and/or SearchResults class.  I'm already filtering/searching a Module Builder content type by multiple fields, including a custom hierarchical taxonomy and by distance (using Geolocation API), but I don't see how to make "All Words" and "Any Word" work. Since the WordsMode property is never passed to the BuildSearchQuery method, I assume this property is unused.  I'm looking for the "magic" in the Search assemblies, but would appreciate any insight into what I'd need to override to enable the any/all words search modes.
  2. LBrinley
    LBrinley avatar
    59 posts
    Registered:
    29 Dec 2005
    26 Dec 2013 in reply to LBrinley
    Link to this post
    Work around found.
    Use a custom SearchBox widget/class to allow selection of wordsMode and pass its value in the querystring.  Use a custom SearchResults widget/class and override the InitializeControls method to retrieve the WordsMode from the querystring then modify a copy (keeping the original) of the query  passed from the SearchBox to include "AND" (for All Words mode)  or "OR" (for Any Word mode) between each pair of terms in the original query. Pass the "modified" query to the BuildSearchQuery method and you have correct Any/All Word results. Keeping the original query relieves you of having to remove the ANDs or ORs from the ResultsStats message.

    However, if anyone knows of how I can get WordsMode to work organically within Sitefinity without my workaround, I'd appreciate it.
2 posts, 0 answered