Hi Damiaan
There are no messages relating to the Examine Search in my logs. I've got all of the correct permissions set up. I even added 'Everyone' to have full permission in the App_Data folder. There are Examine index folders and files in there too.
I would not use the code from that article. :-) It has some practices like this one:
private UmbracoHelper _uHelper { get { return new UmbracoHelper(UmbracoContext.Current); } }
You already have a property "Umbraco" on the SurfaceController exposing an umbracohelper. So you don't need to create another copy of it.
Also, you are using MemoryCache.Default. I have some doubts on that. E.g. why are you caching lucene results? Is you search so intensive? If you have a big site, with lot of seaches, you will be caching complete documents multiple times in memory for different searches. And last remark about using this: you are not using lock() to insert something into the cache. Have you considered the built-in CacheHelper?
That being said, if you really want to use your code from your article, you should supply a littlebit more information on what exactly is not working.
Do you have build errors or runtime errors? Do you have a stacktrace? If you are debugging, what line does return unexpected results? What do you see, and what not?
Thanks for your points about caching. I just didn't think it needed to query again to get results for each page.
I have this working on one site absolutely fine and it works a great. It's just when I put it on another site there are no results coming back. Are there some settings I need to turn on or change?
Do you have build errors or runtime errors? If so, do you have a stacktrace? If you are debugging, what line does return unexpected results? What do you see, and what not?
This will give you the generated query, copy out of the only the lucene query bit then in Examine manager run that lucene query see if you get any results. Also may be try and open the index on the server using luke then try running the query in that.
you have two options 1, run the query in examine manager in the back office there is option to use lucene syntax you can then paste the query in there and run it.
Download luke for lucene (https://code.google.com/archive/p/luke/downloads get v3.5.0) , you will need java as its written in java. Then you will need to open your index with that so either run luke on the machine that is not working or get a copy of the index then try opening it locally.
Thanks for the tip about getting the output of the search criteria and using Luke. I've managed to query my index using Luke. There are no results using the query which was outputted, but if I take some off I start to get results so I'm getting somewhere. Thank you.
I ran into your blog post to create advanced search, and started implementing it, but ran into some (probably older) syntax, etc, that needed updated. I'm curious if you're planning on updating the post with code that'll work with Umbraco 8+?
I'm getting close to wrapping up a custom .Net site into an Umbraco CMS instance, and the Predictive Search and Search functionality is where I'm at now. Currently, the site does sql calls to get products, pages, blog posts, etc, and puts them into repositories to use and theme out in both a predicitve results set and on the search page itself.
Examine search is not working on my site
Hi all I've used Examine a lot on different sites, but I can't get it to work on a site I'm working on. I just get no results whatsoever.
Have you had this problem before?
Can you help please?
Thanks
Paul
Paul,
Do you have messages in the log (app_data/logs)?
Are your write permissions ok?
Kind regards
Damiaan
Hi Damiaan There are no messages relating to the Examine Search in my logs. I've got all of the correct permissions set up. I even added 'Everyone' to have full permission in the App_Data folder. There are Examine index folders and files in there too.
Kind regards
Paul
Searching the wrong index? Does the index contains items when using the "examine management" tab in de developer section?
Yes I get search results using the search tools in examine management, lucene search.
This is the exact code I am using. Please try and implement it and let me know why I'm doing wrong.
http://www.codeshare.co.uk/blog/how-to-search-by-document-type-and-property-in-umbraco/
I would not use the code from that article. :-) It has some practices like this one:
You already have a property "Umbraco" on the SurfaceController exposing an umbracohelper. So you don't need to create another copy of it.
Also, you are using
MemoryCache.Default
. I have some doubts on that. E.g. why are you caching lucene results? Is you search so intensive? If you have a big site, with lot of seaches, you will be caching complete documents multiple times in memory for different searches. And last remark about using this: you are not using lock() to insert something into the cache. Have you considered the built-in CacheHelper?That being said, if you really want to use your code from your article, you should supply a littlebit more information on what exactly is not working.
Do you have build errors or runtime errors? Do you have a stacktrace? If you are debugging, what line does return unexpected results? What do you see, and what not?
Kind regards
Damiaan
Thanks for your points about caching. I just didn't think it needed to query again to get results for each page.
I have this working on one site absolutely fine and it works a great. It's just when I put it on another site there are no results coming back. Are there some settings I need to turn on or change?
Then you probably forgot something to copy.
Do you have build errors or runtime errors? If so, do you have a stacktrace? If you are debugging, what line does return unexpected results? What do you see, and what not?
I'm not getting any build or runtime errors. The search just comes back with no results.
I took on board your feedback and changed the code, removing caching etc.
Paul,
On you local machine step through with a debugger then at line:
Just before it do
This will give you the generated query, copy out of the only the lucene query bit then in Examine manager run that lucene query see if you get any results. Also may be try and open the index on the server using luke then try running the query in that.
Regards
Ismail
Hi Ismail Thanks for this, how do I run the lucene query myself once I have copied it?
Cheers
Paul
Paul,
you have two options 1, run the query in examine manager in the back office there is option to use lucene syntax you can then paste the query in there and run it.
Regards
Ismail
Thanks for the tip about getting the output of the search criteria and using Luke. I've managed to query my index using Luke. There are no results using the query which was outputted, but if I take some off I start to get results so I'm getting somewhere. Thank you.
I need to see the query can you paste it please.
This is the query that is not working:
The umbracoNaviHide:0 does not look right to me which is generated by code
You need something like:
This will generate
So you do not need that or stuff. In fact I am certain this is the issue looking at your code:
You cannot do this with lucene you. So in sql you can do
select * from whatever where field=''
See this post https://lists.gt.net/lucene/java-user/64663
Lets say you have field called town. You want to pull back all documents in the index where town is empty. You cannot do as you are doing
You would have to use gathering node data event and then test if town is null or empty then inject in a blag value e.g emptyTown.
Then you could do
This would then get you all documents with town not set.
Regards
Ismail
Thanks for your help. I was able to get it working by changing this line:
with this line
haha so it was the umbracoNaviHide.
Yes, but the strange thing is it has worked on other sites.
But thank you so much. You've helped me learn more about Examine.
I love it, I write posts about things I've learned and I always end up learning more from others.
h5yr
Paul,
There is an official examine course due very soon. Covers alot of this kind of stuff.
Regards
Ismail
Paul,
I ran into your blog post to create advanced search, and started implementing it, but ran into some (probably older) syntax, etc, that needed updated. I'm curious if you're planning on updating the post with code that'll work with Umbraco 8+?
https://codeshare.co.uk/blog/how-to-search-by-document-type-and-property-in-umbraco/
I'm getting close to wrapping up a custom .Net site into an Umbraco CMS instance, and the Predictive Search and Search functionality is where I'm at now. Currently, the site does sql calls to get products, pages, blog posts, etc, and puts them into repositories to use and theme out in both a predicitve results set and on the search page itself.
Jason
is working on a reply...