EPiServer.Search onlywholewords

Timea Eriksson
Member since: 2005
 

Hi!

I need some help with my searchfunction as it only seems to search for wholewords. I'm not using the searchdatasource, but I see that the property "OnlyWholeWords" has been marked as obsolete with the explanation that it is now handled by Indexing Service. I need to search for both leading and trailing wildcard. The trailing wildcard works fine by adding "mysearchterm*", but not the leading trail. Searching for "*search*" should then find "mysearchterm".

In previous versions of Lucene this wasn't possible, but it seems as from version 2.1 there is a setting QueryParser.setAllowLeadingWildcard(true) for this to work. How can I access this setting in my search? Is it possible?

Best regards,

Timea

#64707 Jan 07, 2013 16:32
  • Azzlack
    Member since: 2010
     

    EPiServer does not currently expose a method for setting this property.

    The only way atm. is to create a custom indexing handler.

    #66245 Feb 25, 2013 16:34
  • Vasileios Odontidis
    Member since: 2012
     

    Well that is a late reply but in any case. Add "~" to the end of the string that you are searching for with Lucene. If I understood properly your question that will do the trick. And the neat thing with that is that it if you look for stor it will return words like story or sto but never something like st or etc. 

    #66747 Mar 08, 2013 11:04