|
|
Rank: Fanatic
Joined: 3/15/2007 Posts: 378 Location: Cary, NC USA
|
ovalsquare wrote:This is an excellent post (and quite incredible help provided from beginning to end). Is the source going to ever be made available to the community? ovalsquare - you can download the umbracoext project source at: http://www.codeplex.com/umbracoext/SourceControl/ListDownloadableCommits.aspxI can provide the updated class files I used if you like and want to make it function as outlined in the above thread. I believe the core code set I used last year was an older one (2939).
|
|
 Rank: Addict
Joined: 7/19/2006 Posts: 649 Location: Preston, UK
|
Guys, I did an openspace format on lucene search at code garden more information here I am hoping at some point to release a package with documentation. Regards Ismail
Level 2 certified. If it aint broke dont fix.
|
|
Rank: Fanatic
Joined: 3/15/2007 Posts: 378 Location: Cary, NC USA
|
Ismail - sounds very cool... can't wait to see the package version...
|
|
 Rank: Fanatic
Joined: 8/9/2007 Posts: 284 Location: Kentucky, USA
|
Hey John -- I am still using the package you made for me and loving it. But I have a question. Is it possible for me to customize what gets returned as the result (resultHighlight)? I don't like the way it seems to just mash together all of the fields it is indexing. Ideally, I would like to have it return only the field(s) I specify. For most of the pages on my site, there will be a field called abstract which will contain a concise summary of the page contents -- that is what I would like to see in the result. But I would also like to specify alternate fields if that one is missing or blank. With XSLT Search, this was easy to configure. I suspect it is easy to do with Lucene as well but I don't see it documented. Thanks for any insight you might have on this.
Pete Koutoulas • Fayette County Public Schools • Lexington, Kentucky
|
|
Rank: Fanatic
Joined: 3/15/2007 Posts: 378 Location: Cary, NC USA
|
|
|
 Rank: Fanatic
Joined: 8/9/2007 Posts: 284 Location: Kentucky, USA
|
Thanks! I have downloaded and will give it a try. I may not get to it today, but I will test it out soon and let you know. But based on your description, I think this will work great.
Pete Koutoulas • Fayette County Public Schools • Lexington, Kentucky
|
|
Rank: Fanatic
Joined: 3/15/2007 Posts: 378 Location: Cary, NC USA
|
Pete - I found a bug where I didn't have a trap put in place for an abstractAlias check in case no value exists... please give this updated version a try: http://www.ncbar.org/download/snaps/umbSearch_06132008.zip
|
|
 Rank: Fanatic
Joined: 8/9/2007 Posts: 284 Location: Kentucky, USA
|
John, I have updated and tested and it seems to be working as advertised. It is displaying my abstract field using the XSLT file. However, it now has stopped indexing my media files. Can you think of any reason this would be happening?
Pete Koutoulas • Fayette County Public Schools • Lexington, Kentucky
|
|
Rank: Fanatic
Joined: 3/15/2007 Posts: 378 Location: Cary, NC USA
|
hmm... that's interesting... mine is still working (at least xslt)... what is your start node set to? also, are you using the excludeFileFromSearch property? you may want to check that as well...
|
|
 Rank: Fanatic
Joined: 8/9/2007 Posts: 284 Location: Kentucky, USA
|
jHodgkinson wrote:hmm... that's interesting... mine is still working (at least xslt)... what is your start node set to? also, are you using the excludeFileFromSearch property? you may want to check that as well... Well, I left the StartAtNode property of the search result macro blank. But that shouldn't effect what gets indexed anyway, right? I mean, as I understand it, the macro and the XSLT file only determine what gets returned in a search and how it is presented, right? (I hope so, since I plan to have several different search pages for different sections of my site.) I had not used the excludeFileFromSearch property, but just to eliminate this issue I went ahead and added it to my file media type and set it to true for a few files and false for a few others. Then I re-indexed the site and still no media nodes are getting indexed. I also added some MS Word documents to see if it was limited to just PDF's, but those failed to index as well. I verified that the files your package added to my bin folder are still there (pdfilter.dll, msOfficeFilter.dll, Lucene.Net.dll, etc.) and that I was in fact using the latest umbSearch.dll file from th elink above.) Here are the settings in my config file. Maybe something else is not right... Code:<?xml version="1.0" encoding="utf-8" ?> <indexConfiguration> <!-- separate multiple items with semicolons --> <indexDataWithAliases>pageTitle;keywords;abstract;bodyText;subTitle;title;umbracoFile;sidebarContent;sidebarTitle</indexDataWithAliases> <excludeUmbracoNaviHide>true</excludeUmbracoNaviHide> <excludeNodeTypes></excludeNodeTypes> <excludeIds></excludeIds> </indexConfiguration> This is crazy... it was working a few days ago and now it's not. I can't think of anything that has changed.
Pete Koutoulas • Fayette County Public Schools • Lexington, Kentucky
|
|
Rank: Fanatic
Joined: 3/15/2007 Posts: 378 Location: Cary, NC USA
|
Pete - do you have a mediaTypesToIndex key in your config with allowed media types to be indexed (semi-colon delimited)? i.e. <mediaTypesToIndex>pdf;doc;xls;ppt</mediaTypesToIndex>below is a sample config file: Code:
<?xml version="1.0" encoding="utf-8" ?> <indexConfiguration>
<!-- separate multiple items with semicolons -->
<indexDataWithAliases>bodyText;navTitle</indexDataWithAliases>
<excludeUmbracoNaviHide>true</excludeUmbracoNaviHide>
<excludeNodeTypes></excludeNodeTypes>
<excludeIds>0</excludeIds>
<indexFilesWithAliases>umbracoFile</indexFilesWithAliases>
<mediaTypesToIndex>pdf;doc;xls;ppt</mediaTypesToIndex>
<!-- the username (login) for a user who should receieve error messages (mails) when the index doesn't update --> <alertUserAlias>administrator</alertUserAlias>
</indexConfiguration>
|
|
 Rank: Fanatic
Joined: 8/9/2007 Posts: 284 Location: Kentucky, USA
|
That was it -- boy do I feel dumb. Somehow I had deleted both the mediaTypesToIndex and indexFilesWithAliases tags from my config file. By the way, in my XSLT file I added a xsl:choose block so I could use resultAbstract if not blank and resultHighlight otherwise. It is working beautifully. Exactly what I needed. Thanks once again for your patient help.
Pete Koutoulas • Fayette County Public Schools • Lexington, Kentucky
|
|
Rank: Fanatic
Joined: 3/15/2007 Posts: 378 Location: Cary, NC USA
|
Pete - good deal... glad it was just a minor setting ;) have a great weekend!
|
|
 Rank: Devotee
Joined: 3/19/2008 Posts: 49 Location: London
|
John, Thanks very much for the useful post and to Pete for getting it going. I've followed through everything you've done so far and tried to implement something similar on a site that I'm working on. There's a catch on my side though: A previous develper has used Bjornbakk's MultiContent picker which saves its links as a collection of <node>xxx</node> elements. This breaks the umbSearch.dll I ended up downloading the source of the umbSearch DLL to find the line of code that was breaking and managed to trace it to the AddNodeToIndex method, which looks for a "path" attribute on every <node> element (n.Attributes.GetNamedItem("path")) The problem is that Bjornbakk's solution doesn't have a path attribute so I added a fix to the method and put an if( n.Attributes.GetNamedItem("path") != null ) test. Code: public static bool AddNodeToIndex(XmlNode n, IndexWriter writer, string[] excludeIds) {
Hashtable _fields = new Hashtable(); bool _succes = false; bool excludeNode = false; for (int i = 0; i < excludeIds.Length; i++)
//***************************************************** // Check that the "node" element is a content-item and not a multi-content-picker link <node>xxx</node> //***************************************************** if (n.Attributes.GetNamedItem("path") != null) {
if (("," + n.Attributes.GetNamedItem("path").Value + ",").IndexOf("," + excludeIds[i] + ",") > -1) excludeNode = true;
// Test for access if (umbraco.library.IsProtected(int.Parse(n.Attributes.GetNamedItem("id").Value), n.Attributes.GetNamedItem("path").Value)) excludeNode = true; } else { excludeNode = true; } // Test for nodeType ... (rest of method omitted) ...
I really prefer your solution though because like you, I need to index media files that aren't referenced via a content picker. I was wondering if you'd be willing to share the source of your Indexer.cs class with the changes that index all media content so that I could apply that fix and compile a working dll for my project? (I can then leave the client with a working source solution that they could maintain for future umbraco releases). And many thanks again for your help so far.
Neil
|
|
 Rank: Devotee
Joined: 3/19/2008 Posts: 49 Location: London
|
John, Don't worry about my last post - you've answered my question in another post already... Found your code here: http://forum.umbraco.org/yaf_postst4949_Iterate-Media-Tree--NET-UserControl.aspx
Neil
|
|
 Rank: Fanatic
Joined: 8/9/2007 Posts: 284 Location: Kentucky, USA
|
To jHodgkinson or anyone else familiar with the Lucene code: I have 2 questions about customizing this. First, is there a way to tweak the index so that certain data fields can be weighted? For example, I would like to place heavy weight on my pageTitle and keywords fields so that searches where the search term appears in those fields get pushed ahead of those where the term only appears in the bodyText. With XSLT Search, this was an easy configuration to set. I am hoping there is a way to do it with Lucene, even if I have to delve into the source. (If that is the case, where can I obtain the source? John, I am using your version, so I guess I would need to get it from you.) Second, is there a way (again, this probably means editing source code) to expose additional fields to the result set? Specifically, I need to get a custom property I called pageTitle. The resultTitle seems to be returning the node name. Any help would be greatly appreciated!
Pete Koutoulas • Fayette County Public Schools • Lexington, Kentucky
|
|
Rank: Enthusiast
Joined: 1/7/2008 Posts: 37
|
Where the sources for this package can be found? I downloaded changset 21521 form codeplex.com//umbracoext/ but it seems that sources are not actual.
|
|
Rank: Enthusiast
Joined: 8/19/2008 Posts: 37 Location: Utah, USA
|
Great post guys, this is going to make my life great. Thanks for your time.
|
|
Rank: Enthusiast
Joined: 8/19/2008 Posts: 37 Location: Utah, USA
|
Alright guys, lets see if you can solve my problems now too... I had installed Umbraco Utilites, and tried to use that search, when I would try and populate my index, I would get an ASP.NET Object reference not set to an instance of an object. Error. So I ditched that and found this post, now I've installed this package, and when I try and populate my index, same story. The error is as follows...
Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.] umbSearch.businessLogic.Indexer.AddNodeToIndex(XmlNode n, IndexWriter writer, String[] excludeIds) +135 umbSearch.businessLogic.Indexer.Index() +247 umbSearch.userControls.buildIndex.Button1_Click(Object sender, EventArgs e) +12 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433
|
|
 Rank: Umbracoholic
Joined: 9/8/2006 Posts: 1,689 Location: KY, USA
|
Did you uninstall the umbraco utilities before installing John's package? I think that might be important. cheers, doug.
MVP 2007-2009 - Official Umbraco Trainer for North America - Percipient Studios
|
|
|
Guest |