Given a site where node names are like the list below, how can I use Examine to return only nodes with an exactly matched name?
foo bar foobar foo foo bar
If I search 'bar', I only want the second node returned.
I thought I could use regex in the search term (something like "+nodeName:\"/^{0}$" where {0} is the query) to match on the start and end of the string, but that's not working - it returns all nodes that include the query.
Also tried an inclusive range ("+nodeName: [{0} TO {0}]") which returned nothing.
Examine - return only exact matches
Given a site where node names are like the list below, how can I use Examine to return only nodes with an exactly matched name?
foo
bar
foobar
foo foo bar
If I search 'bar', I only want the second node returned.
I thought I could use regex in the search term (something like "+nodeName:\"/^{0}$" where {0} is the query) to match on the start and end of the string, but that's not working - it returns all nodes that include the query.
Also tried an inclusive range ("+nodeName: [{0} TO {0}]") which returned nothing.
Any ideas would be awesome...
Nathan,
After a bit of digging around i found http://blogs.perl.org/users/mark_leighton_fisher/2012/01/stupid-lucene-tricks-exact-match-starts-with-ends-with.html another thing you could try is in luke do the search but change the analyser to keyword analyser see if that works?
Regards
Ismail
Thanks Ismail - I gave up on using Examine for this one, just grabbed the content I needed with the Umbraco API instead.
is working on a reply...