|
djd0383
2006-09-22, 23:07
Doron Cohen
2006-09-22, 23:17
djd0383
2006-09-22, 23:33
Yonik Seeley
2006-09-22, 23:59
djd0383
2006-09-23, 00:01
Yonik Seeley
2006-09-23, 00:47
Doron Cohen
2006-09-23, 00:47
Chris Hostetter
2006-09-23, 01:03
djd0383
2006-09-25, 14:57
djd0383
2006-09-25, 17:36
Doron Cohen
2006-09-25, 18:01
djd0383
2006-09-25, 18:21
Doron Cohen
2006-09-25, 18:46
djd0383
2006-09-25, 21:17
Doron Cohen
2006-09-25, 22:02
Chris Hostetter
2006-09-26, 00:42
djd0383
2006-10-02, 17:56
Chris Hostetter
2006-10-02, 18:05
djd0383
2006-10-02, 23:40
Chris Hostetter
2006-10-03, 00:16
djd0383
2006-10-03, 15:19
Ryan Heinen
2006-10-03, 16:30
|
-
Searching with "1"djd0383 2006-09-22, 23:07
I am managing a few Lucene searches in the application that I am building. We have noticed that when a user searches with the string "1", this will throw an exception. The search works fine until Lucene tries to build its Hits. Is there any reason why this would be true? Also, what is a common solution to this issue, so my users can search with "1"? Thanks. -- View this message in context: http://www.nabble.com/Searching-with-%221%22-tf2320552.html#a6456507 Sent from the Lucene - Java Developer mailing list archive at Nabble.com. ---------------------------------------------------------------------
-
Re: Searching with "1"Doron Cohen 2006-09-22, 23:17
What is the exception stack trace?
djd0383 <[EMAIL PROTECTED]> wrote on 22/09/2006 16:07:53: > > I am managing a few Lucene searches in the application that I am building. > We have noticed that when a user searches with the string "1", this will > throw an exception. The search works fine until Lucene tries to build its > Hits. Is there any reason why this would be true? Also, what is a common > solution to this issue, so my users can search with "1"? > > Thanks. > -- > View this message in context: http://www.nabble.com/Searching-with-% > 221%22-tf2320552.html#a6456507 > Sent from the Lucene - Java Developer mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > ---------------------------------------------------------------------
-
Re: Searching with "1"djd0383 2006-09-22, 23:33
Well I am not authorized to give you the entire trace, but here is the iimportant part... org.apache.lucene.search.BooleanQuery.add(BooleanQuery.java:79) org.apache.lucene.search.BooleanQuery.add(BooleanQuery.java:71) org.apache.lucene.search.PrefixQuery.rewrite(PrefixQuery.java:50) org.apache.lucene.search.IndexSearcher.rewrite(IndexSearcher.java:166) org.apache.lucene.search.Query.weight(Query.java:84) org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:85) org.apache.lucene.search.Hits.getMoreDocs(Hits.java:64) org.apache.lucene.search.Hits.<init>(Hits.java:43) org.apache.lucene.search.Searcher.search(Searcher.java:33) org.apache.lucene.search.Searcher.search(Searcher.java:27) .... Also, I forgot to mention, but the error is throwing a message implying it cannot search on null. Hope that helps. Thank you for the speedy responce. Doron Cohen wrote: > > What is the exception stack trace? > > djd0383 <[EMAIL PROTECTED]> wrote on 22/09/2006 16:07:53: >> >> I am managing a few Lucene searches in the application that I am > building. >> We have noticed that when a user searches with the string "1", this will >> throw an exception. The search works fine until Lucene tries to build > its >> Hits. Is there any reason why this would be true? Also, what is a > common >> solution to this issue, so my users can search with "1"? >> >> Thanks. >> -- >> View this message in context: http://www.nabble.com/Searching-with-% >> 221%22-tf2320552.html#a6456507 >> Sent from the Lucene - Java Developer mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Searching-with-%221%22-tf2320552.html#a6456825 Sent from the Lucene - Java Developer mailing list archive at Nabble.com. ---------------------------------------------------------------------
-
Re: Searching with "1"Yonik Seeley 2006-09-22, 23:59
On 9/22/06, djd0383 <[EMAIL PROTECTED]> wrote:
> Also, I forgot to mention, but the error is throwing a message implying it > cannot search on null. The analyzer you are using is throwing away the "1" leaving nothing left to search on. -Yonik http://incubator.apache.org/solr Solr, the open-source Lucene search server ---------------------------------------------------------------------
-
Re: Searching with "1"djd0383 2006-09-23, 00:01
And why would Lucene be doing that now? That just doesn't seem to be the right thing to do. Yonik Seeley wrote: > > On 9/22/06, djd0383 <[EMAIL PROTECTED]> wrote: >> Also, I forgot to mention, but the error is throwing a message implying >> it >> cannot search on null. > > The analyzer you are using is throwing away the "1" leaving nothing > left to search on. > > -Yonik > http://incubator.apache.org/solr Solr, the open-source Lucene search > server > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Searching-with-%221%22-tf2320552.html#a6457067 Sent from the Lucene - Java Developer mailing list archive at Nabble.com. ---------------------------------------------------------------------
-
Re: Searching with "1"Yonik Seeley 2006-09-23, 00:47
On 9/22/06, djd0383 <[EMAIL PROTECTED]> wrote:
> And why would Lucene be doing that now? That just doesn't seem to be the > right thing to do. It's often not the right thing to do, but it's all under your control. It depends on exactly what your analyzer looks like (what tokenizers and tokenfilters you are using). -Yonik http://incubator.apache.org/solr Solr, the open-source Lucene search server > > On 9/22/06, djd0383 <[EMAIL PROTECTED]> wrote: > >> Also, I forgot to mention, but the error is throwing a message implying > >> it > >> cannot search on null. > > > > The analyzer you are using is throwing away the "1" leaving nothing > > left to search on. > > > > -Yonik ---------------------------------------------------------------------
-
Re: Searching with "1"Doron Cohen 2006-09-23, 00:47
djd0383 <[EMAIL PROTECTED]> wrote on 22/09/2006 17:01:47:
> > And why would Lucene be doing that now? That just doesn't seem to be the > right thing to do. > This would depend on the analyzer being used. It puzzles me that you say the user query is "1" but the query that throws the exception is PrefixQuery. Do you create the Prefix query programmatically, or do you use QueryParser? QueryParser would create a prefix query for "1*" but not for "1". If you list a short snippet of code that you use for the search this would help, e.g. something like: ... String qtxt = "1"; QueryParser qp = new QueryParser("fieldName", new StandardAnalyzer()); Query q = qp.parse(qtxt); ... ---------------------------------------------------------------------
-
Re: Searching with "1"Chris Hostetter 2006-09-23, 01:03
: Well I am not authorized to give you the entire trace, but here is the
: iimportant part... : : org.apache.lucene.search.BooleanQuery.add(BooleanQuery.java:79) : org.apache.lucene.search.BooleanQuery.add(BooleanQuery.java:71) : org.apache.lucene.search.PrefixQuery.rewrite(PrefixQuery.java:50) : org.apache.lucene.search.IndexSearcher.rewrite(IndexSearcher.java:166) 1) where is the top of the stack trace showing the Exception class and the exception message? ... those are just as important. 2) you need to clarify what you mean by 'Searching with "1"' ... that stack trace indicates that your query is really a PrefixQuery (not a simple TermQuery on "1") ... what is the query.toString() ? how did you build it (ie: did you use QueryParser?) 3) can you clarify what version of Lucene you are using ... those line numbers don't jive with the trunk. -Hoss ---------------------------------------------------------------------
-
Re: Searching with "1"djd0383 2006-09-25, 14:57
The top of the stack was the stack I posted. I am not able to give the entire stack, but this is the important part. The exception is something about searching with null. When I say that I am searching for '1', the user is phyisically entering '1' into the search form and submitting. This search works just fine for, say, 2 or 12. Lucene has a class named Hits. The serach string which is passed to this class is '1*'. The version we are using is 1.4.3. Chris Hostetter wrote: > > : Well I am not authorized to give you the entire trace, but here is the > : iimportant part... > : > : org.apache.lucene.search.BooleanQuery.add(BooleanQuery.java:79) > : org.apache.lucene.search.BooleanQuery.add(BooleanQuery.java:71) > : org.apache.lucene.search.PrefixQuery.rewrite(PrefixQuery.java:50) > : org.apache.lucene.search.IndexSearcher.rewrite(IndexSearcher.java:166) > > 1) where is the top of the stack trace showing the Exception class and the > exception message? ... those are just as important. > > 2) you need to clarify what you mean by 'Searching with "1"' ... that > stack trace indicates that your query is really a PrefixQuery (not a > simple TermQuery on "1") ... what is the query.toString() ? how did you > build it (ie: did you use QueryParser?) > > 3) can you clarify what version of Lucene you are using ... those line > numbers don't jive with the trunk. > > > > > -Hoss > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Searching-with-%221%22-tf2320552.html#a6488140 Sent from the Lucene - Java Developer mailing list archive at Nabble.com. ---------------------------------------------------------------------
-
Re: Searching with "1"djd0383 2006-09-25, 17:36
My QueryParser looks like this: query = QueryParser.parse("1*","allText",analyzer); analyzer is predetermited for this class. Is there something special I should be setting in this to allow for this search string? Thanks again! Doron Cohen wrote: > > djd0383 <[EMAIL PROTECTED]> wrote on 22/09/2006 17:01:47: >> >> And why would Lucene be doing that now? That just doesn't seem to be the >> right thing to do. >> > > This would depend on the analyzer being used. > It puzzles me that you say the user query is "1" but the query that throws > the exception is PrefixQuery. > Do you create the Prefix query programmatically, or do you use > QueryParser? > QueryParser would create a prefix query for "1*" but not for "1". > If you list a short snippet of code that you use for the search this would > help, e.g. something like: > ... > String qtxt = "1"; > QueryParser qp = new QueryParser("fieldName", new StandardAnalyzer()); > Query q = qp.parse(qtxt); > ... > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Searching-with-%221%22-tf2320552.html#a6491379 Sent from the Lucene - Java Developer mailing list archive at Nabble.com. ---------------------------------------------------------------------
-
Re: Searching with "1"Doron Cohen 2006-09-25, 18:01
> My QueryParser looks like this: > query = QueryParser.parse("1*","allText",analyzer); > > analyzer is predetermited for this class. Is there something special I > should be setting in this to allow for this search string? Is it a custom analyzer or one of Lucene's analyzers? Examining the result query will tell if the used analyzer is causing you trouble: what would be printed by adding the following lines just after you create the query? System.out.println("For qtxt 1* the result query is" + query); System.out.println("The analyzer in use is: "+analyzer.getClass().getName() + " - " + analyzer); ---------------------------------------------------------------------
-
Re: Searching with "1"djd0383 2006-09-25, 18:21
Those two message print the following: For qtxt 1* the result query is allText:1* and The analyzer in use is: org.apache.lucene.analysis.standard.StandardAnalyzer - org.apache.lucene.analysis.standard.StandardAnalyzer I hope this helps. Thank you for all your help. Doron Cohen wrote: > > >> My QueryParser looks like this: >> query = QueryParser.parse("1*","allText",analyzer); >> >> analyzer is predetermited for this class. Is there something special I >> should be setting in this to allow for this search string? > > Is it a custom analyzer or one of Lucene's analyzers? > Examining the result query will tell if the used analyzer is causing you > trouble: what would be printed by adding the following lines just after > you > create the query? > > System.out.println("For qtxt 1* the result query is" + query); > System.out.println("The analyzer in use is: > "+analyzer.getClass().getName() + " - " + analyzer); > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Searching-with-%221%22-tf2320552.html#a6492358 Sent from the Lucene - Java Developer mailing list archive at Nabble.com. ---------------------------------------------------------------------
-
Re: Searching with "1"Doron Cohen 2006-09-25, 18:46
djd0383 <[EMAIL PROTECTED]> wrote on 25/09/2006 11:21:13:
> Those two message print the following: > For qtxt 1* the result query is allText:1* and > The analyzer in use is: > org.apache.lucene.analysis.standard.StandardAnalyzer This output seems ok - the analyzer is standard and seems to me the result query should be working. Are you able to modify this small stand-alone program to create the exception you are seeing? public static void main(String[] args) throws Exception { // populate index with 2 docs RAMDirectory dir = new RAMDirectory(); Analyzer anlzr = new StandardAnalyzer(); IndexWriter iw = new IndexWriter(dir,anlzr,true); String fldName = "allText"; Document d1 = new Document(); d1.add(new Field(fldName,"This doc has no ones in it.",Store.NO,Index.TOKENIZED)); iw.addDocument(d1); Document d2 = new Document(); d2.add(new Field(fldName,"This doc has: 123.",Store.NO,Index.TOKENIZED)); iw.addDocument(d2); iw.close(); String qtxt = "1*"; QueryParser qp = new QueryParser(fldName, anlzr); Query query = qp.parse(qtxt); System.out.println("For qtxt "+qtxt+" the result query is: " + query); System.out.println("Analyzer: "+anlzr); IndexSearcher searcher = new IndexSearcher(dir); Hits hits = searcher.search(query); if (hits==null || hits.length()==0) { System.out.println(" NO results."); } else { System.out.println(" RESULTS:"); for (int i = 0; i < hits.length(); i++) { System.out.println(" "+hits.id(i)+" - "+hits.score(i)); } } } ---------------------------------------------------------------------
-
Re: Searching with "1"djd0383 2006-09-25, 21:17
What are the Store and Index classes? It does not seem that my version of Lucene is using them.... Doron Cohen wrote: > > djd0383 <[EMAIL PROTECTED]> wrote on 25/09/2006 11:21:13: >> Those two message print the following: >> For qtxt 1* the result query is allText:1* and >> The analyzer in use is: >> org.apache.lucene.analysis.standard.StandardAnalyzer > > This output seems ok - the analyzer is standard and seems to me the result > query should be working. Are you able to modify this small stand-alone > program to create the exception you are seeing? > > public static void main(String[] args) throws Exception { > // populate index with 2 docs > RAMDirectory dir = new RAMDirectory(); > Analyzer anlzr = new StandardAnalyzer(); > IndexWriter iw = new IndexWriter(dir,anlzr,true); > String fldName = "allText"; > Document d1 = new Document(); > d1.add(new Field(fldName,"This doc has no ones in > it.",Store.NO,Index.TOKENIZED)); > iw.addDocument(d1); > Document d2 = new Document(); > d2.add(new Field(fldName,"This doc has: > 123.",Store.NO,Index.TOKENIZED)); > iw.addDocument(d2); > iw.close(); > > String qtxt = "1*"; > QueryParser qp = new QueryParser(fldName, anlzr); > Query query = qp.parse(qtxt); > System.out.println("For qtxt "+qtxt+" the result query is: " + query); > System.out.println("Analyzer: "+anlzr); > > IndexSearcher searcher = new IndexSearcher(dir); > Hits hits = searcher.search(query); > if (hits==null || hits.length()==0) { > System.out.println(" NO results."); > } else { > System.out.println(" RESULTS:"); > for (int i = 0; i < hits.length(); i++) { > System.out.println(" "+hits.id(i)+" - "+hits.score(i)); > } > } > > } > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Searching-with-%221%22-tf2320552.html#a6495702 Sent from the Lucene - Java Developer mailing list archive at Nabble.com. ---------------------------------------------------------------------
-
Re: Searching with "1"Doron Cohen 2006-09-25, 22:02
djd0383 <[EMAIL PROTECTED]> wrote on 25/09/2006 14:17:56:
> What are the Store and Index classes? It does not seem that my version of > Lucene is using them.... That code was using Lucene 2.0. In Lucene 1.4.3 you would add the docs like this: boolean store = false; boolean index = true; boolean token = true; d1.add(new Field(fldName,"This doc has no ones in it.",store,index,token)); ---------------------------------------------------------------------
-
Re: Searching with "1"Chris Hostetter 2006-09-26, 00:42
: The top of the stack was the stack I posted. I am not able to give the : entire stack, but this is the important part. The exception is something : about searching with null. when i say "the top of the stack trace" i mean what you just described: "something about searching with null" .. what exactly does it say about searching with null? What is the class of the exception? This is an example of the "top" of a stack trace... org.apache.solr.core.SolrException: Error parsing Lucene query at org.apache.solr.search.QueryParsing.parseQuery(QueryParsing.java:87) at org.apache.solr.request.StandardRequestHandler.handleRequest(StandardRequestHandler.java:108) at org.apache.solr.core.SolrCore.execute(SolrCore.java:586) ... equally important is if the stack trace contains any lines starting with someling like "Caused by:" which would be much "lower" in the stack, possibly after your own custom classes, but they show the root of the problem. the example Solr exception i posted above is fairly useless for understanding the root cause of the problem unless you look at the full stack trace and see much farther down a "Caused by" line explaining what really went wrong... org.apache.solr.core.SolrException: Error parsing Lucene query at org.apache.solr.search.QueryParsing.parseQuery(QueryParsing.java:87) at org.apache.solr.request.StandardRequestHandler.handleRequest(StandardRequestHandler.java:108) at org.apache.solr.core.SolrCore.execute(SolrCore.java:586) at org.apache.solr.servlet.SolrServlet.doGet(SolrServlet.java:91) at javax.servlet.http.HttpServlet.service(HttpServlet.java:596) ... Caused by: org.apache.lucene.queryParser.ParseException: Cannot parse 'id:*1*': Lexical error at line 1, column 4. Encountered: "*" (42), after : "" at org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:129) at org.apache.solr.search.QueryParsing.parseQuery(QueryParsing.java:77) ... ...these are just a few example why only posting "part" of a stack trace isn't allways enough to help diagnose your problem. -Hoss ---------------------------------------------------------------------
-
Re: Searching with "1"djd0383 2006-10-02, 17:56
A bit of progress on this post.... First off, I got the go ahead from the higher ups to install and configure v2.0. I have that installed, configured, indexed, and tested. That is the good news. We were hoping this would just fix this problem, but it didn't. >Are you able to modify this small stand-alone >program to create the exception you are seeing? I did run your small script (minorly modified for try/catch). And here is the output: For qtxt 1* the result query is: allText:1* Analyzer: org.apache.lucene.analysis.standard.StandardAnalyzer@90cb03 RESULTS: 1 - 0.5 Alright now I am confused. Why would this work but our classes - which are practically the same - not work? The only difference in your version and mine is that you switch the IndexReader with RAMDirectory. Any thoughts? Doron Cohen wrote: > > djd0383 <[EMAIL PROTECTED]> wrote on 25/09/2006 11:21:13: >> Those two message print the following: >> For qtxt 1* the result query is allText:1* and >> The analyzer in use is: >> org.apache.lucene.analysis.standard.StandardAnalyzer > > This output seems ok - the analyzer is standard and seems to me the result > query should be working. Are you able to modify this small stand-alone > program to create the exception you are seeing? > > public static void main(String[] args) throws Exception { > // populate index with 2 docs > RAMDirectory dir = new RAMDirectory(); > Analyzer anlzr = new StandardAnalyzer(); > IndexWriter iw = new IndexWriter(dir,anlzr,true); > String fldName = "allText"; > Document d1 = new Document(); > d1.add(new Field(fldName,"This doc has no ones in > it.",Store.NO,Index.TOKENIZED)); > iw.addDocument(d1); > Document d2 = new Document(); > d2.add(new Field(fldName,"This doc has: > 123.",Store.NO,Index.TOKENIZED)); > iw.addDocument(d2); > iw.close(); > > String qtxt = "1*"; > QueryParser qp = new QueryParser(fldName, anlzr); > Query query = qp.parse(qtxt); > System.out.println("For qtxt "+qtxt+" the result query is: " + query); > System.out.println("Analyzer: "+anlzr); > > IndexSearcher searcher = new IndexSearcher(dir); > Hits hits = searcher.search(query); > if (hits==null || hits.length()==0) { > System.out.println(" NO results."); > } else { > System.out.println(" RESULTS:"); > for (int i = 0; i < hits.length(); i++) { > System.out.println(" "+hits.id(i)+" - "+hits.score(i)); > } > } > > } > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Searching-with-%221%22-tf2320552.html#a6606447 Sent from the Lucene - Java Developer mailing list archive at Nabble.com. ---------------------------------------------------------------------
-
Re: Searching with "1"Chris Hostetter 2006-10-02, 18:05
: Alright now I am confused. Why would this work but our classes - which are : practically the same - not work? The only difference in your version and : mine is that you switch the IndexReader with RAMDirectory. : : Any thoughts? My Guess: one of your assumptions is wrong. and there really seems to only be one assumption you are making is that your code and this small test case do the same thing. Add more logging to your code, see exactly what is going on in *your* code. -Hoss ---------------------------------------------------------------------
-
Re: Searching with "1"djd0383 2006-10-02, 23:40
Fixed the issue... It turns out that I was going over TooManyClauses, and this decided to give an exception. I am not really sure of the reasoning behind this exception? It seems to us that it might be better to throw an exception. This way the programmer can handle this accordingly and will force them to do so. Thank you for all your help guys. I really appreciate it! Chris Hostetter wrote: > > > : Alright now I am confused. Why would this work but our classes - which > are > : practically the same - not work? The only difference in your version > and > : mine is that you switch the IndexReader with RAMDirectory. > : > : Any thoughts? > > My Guess: one of your assumptions is wrong. and there really seems to > only be one assumption you are making is that your code and this small > test case do the same thing. > > Add more logging to your code, see exactly what is going on in *your* > code. > > > > -Hoss > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Searching-with-%221%22-tf2320552.html#a6611744 Sent from the Lucene - Java Developer mailing list archive at Nabble.com. ---------------------------------------------------------------------
-
Re: Searching with "1"Chris Hostetter 2006-10-03, 00:16
: It turns out that I was going over TooManyClauses, and this decided to give : an exception. : : I am not really sure of the reasoning behind this exception? It seems to us : that it might be better to throw an exception. This way the programmer can : handle this accordingly and will force them to do so. I'm not understanding your statement. TooManyClauses is a runtime exception that can and will be thrown when a query like PrefixQuery is rewriten to a BooleanQuery -- which happens when a search is executed. so if your problem is that your prefix query was generating too many clauses -- that exception should have in fact been throws ... what do you mean by "this decided to give an exception." if the exception wasn't thrown? -Hoss ---------------------------------------------------------------------
-
Re: Searching with "1"djd0383 2006-10-03, 15:19
After thinking through what was happening in Hits, I decided to see if catching a general exception would come back with anything. Although it can be argued that the code should have been doing this all along, that is a different story. So, I added Exception to the catch clauses, and it in fact catch the TooManyClauses which allowed me to solve to problem. My point though is that if the code was to throw this exception and require me to catch it, this problem would have fixed for me and potentially others as they are writting the code. As an Eclipse user, it is nice when I create a try/catch that it puts in all the required catches from the code within the try. If you were to physically throw this exception, my try would have built the catch when we created it, or at least errored that we needed it. I was just curious why you were not throwing it? Again thanks for your help. Chris Hostetter wrote: > > > : It turns out that I was going over TooManyClauses, and this decided to > give > : an exception. > : > : I am not really sure of the reasoning behind this exception? It seems > to us > : that it might be better to throw an exception. This way the programmer > can > : handle this accordingly and will force them to do so. > > I'm not understanding your statement. TooManyClauses is a runtime > exception that can and will be thrown when a query like PrefixQuery is > rewriten to a BooleanQuery -- which happens when a search is executed. > > so if your problem is that your prefix query was generating too many > clauses -- that exception should have in fact been throws ... what do you > mean by "this decided to give an exception." if the exception wasn't > thrown? > > > -Hoss > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Searching-with-%221%22-tf2320552.html#a6622407 Sent from the Lucene - Java Developer mailing list archive at Nabble.com. ---------------------------------------------------------------------
-
Re: Searching with "1"Ryan Heinen 2006-10-03, 16:30
djd0383 wrote:
> After thinking through what was happening in Hits, I decided to see if > catching a general exception would come back with anything. Although it can > be argued that the code should have been doing this all along, that is a > different story. > > So, I added Exception to the catch clauses, and it in fact catch the > TooManyClauses which allowed me to solve to problem. My point though is > that if the code was to throw this exception and require me to catch it, > this problem would have fixed for me and potentially others as they are > writting the code. As an Eclipse user, it is nice when I create a try/catch > that it puts in all the required catches from the code within the try. If > you were to physically throw this exception, my try would have built the > catch when we created it, or at least errored that we needed it. I was just > curious why you were not throwing it? My guess is that you are asking why TooManyClauses is not a checked exception. I'm not really sure why the decision was made to make it unchecked, but for a queries that will definitely not throw that exception it reduces the amount of clutter/extra code that needs to be written. There are, however, many debates about the merits of using checked vs unchecked exceptions. Hopefully this comment clarifies the question at least. Ryan --------------------------------------------------------------------- |