Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
James McKinney
committed
Apr 11, 2013
1 parent
bbbdf96
commit 96166a2
Showing
3 changed files
with
25 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96166a2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the solution JP. One more "open ended" question; Solr is written in Java, how does javascript work against all the java classes that make up Solr? what books or websites would you recommend I look at to learn how to do this? I don't want to have to keep asking Q's here when I'm stumped...which is just about all the time :/
96166a2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, not sure what books to recommend, you can have a look at this list: http://lucene.apache.org/solr/books.html I've never looked at any of Solr's Java code - I just assume it works and respects its public API :)
96166a2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me flex my Javascript inexperience a bit:
I would think the error handling would want to capture unsuccessful attempts at making calls to Solr but consider any result from Solr (error message or data set) to be a successful call.
jquery uses >> function (servlet, string, handler, errorHandler) {...do stuff.. } << for it's AJAX error handling which gives generic error messages such as JSON.parse: unexpected character if you search for a term like York" but the error in Solr itself will give the specific Invalid character (") at character position 5.
Is it possible to pass Solr's error message back to the UI as a "successful" AJAX call and have the errorHandler check for unsuccessful calls to Solr?
96166a2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you determine whether an error is a Solr error or not?
96166a2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would think the initial AJAX call would have error handling to make sure the call to Solr is not broken (say in case of an invalid URL, network connection error, system failure, etc). Once that call to Solr is successfully made, if the search term causes an error with Solr, that ought to be irrelevant to the AJAX error handler. The entire process has two calls: one from the UI to Solr and then Solr to its Index. The AJAX error handler has the responsibility to cover both calls but losses some specificity as a result. I suppose I'm looking for a way to break it down with the error handler to check only for the UI to Solr connection. Whatever Solr gives back is success.
The response handler (or something) would need to check for something like
If not response.err.msg do response.doc output
else do resposne.err.msg output.
96166a2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can create your own manager that overrides
executeRequest
, checks the response, and either processes it as "successful" or as a failure depending on the contents of the response. I think it makes sense to handle all errors as errors, because error responses are not processable by widgets by default. ajax-solr lets you override its functionality if you want it to behave differently.