You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Bryan LaPlante <bl...@netwebapps.com> on 2003/05/23 23:02:16 UTC

Using MultiSearcher

Hi,
I am have a problem using MultiSearcher and I want to ask if I am using it
properly. Every other run of my jsp page throws an exception on the
msearcher.search(query); line of code, otherwise it runs ok.

the error:
javax.servlet.ServletException: msearcher.search(query):
java.io.IOException: Bad file descriptor

the code:
/**
* There is a method that creates the IndexSearcher[] called idx,
* try/catch blocks have been removed for clarity.
* idx looks like {new
IndexSearcher(IndexReader.open("opt/lucene/index")),new
IndexSearcher(IndexReader.open("search/lucene/index"))}
*/
msearcher = new MultiSearcher(idx);
analyzer = new StopAnalyzer();
query = QueryParser.parse(criteria, "contents", analyzer);
hits = msearcher.search(query);


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Re: Using MultiSearcher

Posted by Bryan LaPlante <bl...@netwebapps.com>.
Ok I found my problem, it was the ArrayList() I used to hold all of the
string values for each index to be searched prior to creating an
IndexSearcher[] array to be passed to the MultiSearcher.

In researching this problem I have uncovered a more serious problem
concerning tag pooling in Tomcat where a tag handler class gets reused for
many instances of the tag in a jsp page.

Tag pooling is designed to enhance performance by reusing the same instance
of a tag handler class for multiple tags on the page. The problem is that
the values passed to these tags is also cached with the instance in the tag
pool. If you try to change the value and reuse the tag it will not pass the
new value unless the jsp page is changed in some way or Tomcat is restarted.

The administrative answer to this problem is to turn off tag pooling for all
jsp pages and not take advantage of the tag pooling. I intend to join the
Tomcat discussion and discuss this issue. It has been my experience that
other platforms such as JRun do not have this particular problem and still
achieve tag pooling, so there must be a solution that will not require an
admin to loose this benefit when using custom tags.

To change the tag pooling behavior in Tomcat do the following:


----------------------------------------------------------------------------
----

  a.. From: Bill Barker
  b.. Subject: Re: HELP:Tagpool sharing problems
  c.. Date: Mon, 28 Apr 2003 22:20:20 -0700

----------------------------------------------------------------------------
----

In $CATALINA_HOME/conf/web.xml, locate the <servlet-name>jsp</servlet-name>
servlet, and add:
  <init-param>
    <param-name>enablePooling</param-name>
    <param-value>false</param-value>
  </init-param>

This will turn off tag-pooling.  You'll also need to clear out
$CATALINA_HOME/work so that the JSP pages get re-compiled.

If you just want it turned off for one context, then you can place the
definition of the jsp servlet in your own web.xml.

If you are using:
  <servlet>
    <servlet-name>myJspPage</servlet-name>
    <jsp-page>myJspPage.jsp</jsp-page>
  </servlet>
then you also need to add the enablePooling init-param to your servlet's
definition.

----- Original Message -----
From: "Bryan LaPlante" <bl...@netwebapps.com>
To: <lu...@jakarta.apache.org>
Sent: Friday, May 23, 2003 4:02 PM
Subject: Using MultiSearcher


> Hi,
> I am have a problem using MultiSearcher and I want to ask if I am using it
> properly. Every other run of my jsp page throws an exception on the
> msearcher.search(query); line of code, otherwise it runs ok.
>
> the error:
> javax.servlet.ServletException: msearcher.search(query):
> java.io.IOException: Bad file descriptor
>
> the code:
> /**
> * There is a method that creates the IndexSearcher[] called idx,
> * try/catch blocks have been removed for clarity.
> * idx looks like {new
> IndexSearcher(IndexReader.open("opt/lucene/index")),new
> IndexSearcher(IndexReader.open("search/lucene/index"))}
> */
> msearcher = new MultiSearcher(idx);
> analyzer = new StopAnalyzer();
> query = QueryParser.parse(criteria, "contents", analyzer);
> hits = msearcher.search(query);
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org