The search string is saying search for the 'word', which is 'me' in the 'contentBody' column.
Or in Lucene syntax, that would be contentBody:me
If I run 'contentBody:me' against my index, then it returns me a nice set of results, so the index is working properly.
I have also tried using the AdvancedSearch, against the standard Umbraco indexes, both by defining them, and also by not declaring them.
-
Interestingly if I type in a madeup index it throws an error (which is good), however when I type in my custom index. It just returns the 'no search results found'. So I'm guessing the fundemental issue is the format of the search string?
I've also tried 'Content' and 'content' it makes no difference. So I had a look at how the indexes work, as far as I can tell as long as your provider is using the type of type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine", it should have this dataTypes of content by default.
Also if for example I change BlogPostSearcher to BlogPostSearcher2, it will throw an error. So its finding the index, it's just unable to search on that datatype. Interestingly you can type in any datatype, e.g mamaslkfjhaosfhaoihfioashfoiafh and it won't throw an error.
Just looking now to find a way to examine (haha no pun intended) the index file, to find where these datatypes are being set and how they are reference (if at all, I guess this could be in the examine layer?)
Using the Search XSLT Extension
Hello,
Just discovered the XSLT extension for requesting Examine/Lucene searches via XSLT.
Having a bit of difficultly getting this going though...
<!-- Let's define our search variables -->
<xsl:variable name="searchString" select="'(+contentBody: humira)'"/>
<xsl:variable name="boolean" select="'+'" />
<!-- Let's write a basic search -->
<xsl:value-of select="ucomponents.search:AdvancedSearch($searchString, $boolean, 'InternalIndexSet', 'content')"/>
My questions would be;
searchText = what is being expected here?
useWildcards = what is being expected here?
providerName = what is being expected here? Would you standardly use 'InternalIndexer'?
indexType = same ;)
Thanks! (: Looking forward to building something snappy (: Lau
Hi Lau,
OK, these extensions don't use Lucene query syntax - as they build it up themselves internally... using a querystring format (key=value&key2=value2)
Also the boolean for the "useWildcard" needs to be a boolean (true/false) ... and the providerName needs to be a search provider, not the index set.
Soooo... try something like this:
... but if you just want to query the search term against all the fields, go with QuickSearch:
Good luck!
Cheers, Lee.
Hmm interesting. QuickSearch works perfectly, however AdvancedSearch returns no results.
Digging a bit deeper, I checked the ExamineIndex.config and noticed the InternalSearcher does not have 'contentBody' as a field.
So I changed my search query to 'nodeName=humira', which should return some results, however still nothing. Odd! >.<
Thanks! (: Lau
Hi Lau,
Doh! Why are we using "value-of"? Its meant to return a node-set... so try this and see what it comes back with?
I got rid of the other params - as they were using the default values anyway.
Cheers, Lee.
Just tried that still no joy...
<!-- Let's write a advanced search -->
<h1>Advanced Search - with Params</h1>
<xsl:value-of select="ucomponents.search:AdvancedSearch('nodeName=Humira', true(), 'InternalSearcher', 'Content')"/>
<h1>Advanced Search - no Params</h1>
<xsl:copy-of select="ucomponents.search:AdvancedSearch('nodeName=humira')" />
<!-- Basic Search -->
<xsl:variable name="search" select="ucomponents.search:QuickSearch('humira')"/>
<!-- Let's process our results -->
<h1>Basic Search</h1>
<xsl:for-each select="$search/* [@isDoc]">
<xsl:call-template name="result" />
</xsl:for-each>
</xsl:template>
<xsl:template name="result">
<li><xsl:value-of select="@nodeName" /></li>
</xsl:template>
The Basic Search returns a beautiful set of results, and we can then even make them into a nice little list with the template at the bottom.
But both;
Advanced Search - With Params & Advanced Search - No Params
Return no results. :(
Just quickly fired up Luke to check the index files are working properly.
So the way I read it
<xsl:value-of select="ucomponents.search:AdvancedSearch('contentBody=me', true(), 'InternalSearcher', 'Content')"/>
The search string is saying search for the 'word', which is 'me' in the 'contentBody' column.
Or in Lucene syntax, that would be contentBody:me
If I run 'contentBody:me' against my index, then it returns me a nice set of results, so the index is working properly.
I have also tried using the AdvancedSearch, against the standard Umbraco indexes, both by defining them, and also by not declaring them.
-
Interestingly if I type in a madeup index it throws an error (which is good), however when I type in my custom index. It just returns the 'no search results found'. So I'm guessing the fundemental issue is the format of the search string?
Maybe? Just a hunch. /Laux
Hi Lau,
I keep looking at the last parameter (of your last example) ... pretty sure it needs to be a lowercase "content".
Also when you change the "<xsl:value-of" to <xsl:copy-of" ... do you get any <error> XML returned?
Cheers, Lee.
Okay so I've dug a little deeper...
copy-of / value-of makes no difference, well except one returns the XML structure and one doesn't (in simple terms).
So for example I now have...
<h1>Advanced Search - with Params</h1>
<xsl:copy-of select="ucomponents.search:AdvancedSearch('id=****', true(), 'InternalSearcher', 'Content')"/>
<h1>Advanced Search - no Params</h1>
<xsl:copy-of select="ucomponents.search:AdvancedSearch('id=****', true(), 'BlogPostSearcher', 'content')" />
The first of which works, but the second doesn't.
I've also tried 'Content' and 'content' it makes no difference. So I had a look at how the indexes work, as far as I can tell as long as your provider is using the type of type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine", it should have this dataTypes of content by default.
Also if for example I change BlogPostSearcher to BlogPostSearcher2, it will throw an error. So its finding the index, it's just unable to search on that datatype. Interestingly you can type in any datatype, e.g mamaslkfjhaosfhaoihfioashfoiafh and it won't throw an error.
Just looking now to find a way to examine (haha no pun intended) the index file, to find where these datatypes are being set and how they are reference (if at all, I guess this could be in the examine layer?)
Lau
Any further still, on the working on I can change the 'Content' to "asjfopajsfpoasjfpoasjfopja" and it will still return results!
ARghh! >.<
is working on a reply...